开发者

Rails - execute multiple queries in a single connection

开发者 https://www.devze.com 2022-12-22 09:26 出处:网络
How do I开发者_JS百科 issue multiple SQL queries in a single database connection in Rails? My problem is, Ihave multiple records(about 200 or more records) to be checked with the database table\'s exi

How do I开发者_JS百科 issue multiple SQL queries in a single database connection in Rails? My problem is, I have multiple records(about 200 or more records) to be checked with the database table's existing records(I am checking composite primary key values) I could use ActiveRecord's exists? method in a single transaction block. But I don't know whether ActiveRecord uses a single connection to do this instead of creating multiple connections for each entry. All I need is a way to check records existence in a single connection with a maximum performance with lower overhead on both sides Mysql and Rails ?? Any suggestions for this please..


ActiveRecord uses a single persistant database connection.

0

精彩评论

暂无评论...
验证码 换一张
取 消