lundi 25 mai 2015

Run a rails query in batches

I have a table A(:name, :address, :phone) consisting of 500,000 entries. I want to run this query :

johns = A.where(:name => "John")

This query should return 150,000 results. But running this query gives me this result : Killed.

How should I rewrite this query so that the query runs on batches of 1000 in the database?

Aucun commentaire:

Enregistrer un commentaire