Today I ran into an issue while reading a quite significant mysql database table. I needed to fetch the records in batches so the good old find_in_batches method in rails ActiveRecord came into picture. Now the actual problem surfaced, as the lookup table was not having any sort of ID column present, the find_in_batches kept throwing an error Invalid Statement. After some debugging it came to light that find_in_batches by default only works with Integer only Primary Key fields, as it uses order to order the records as per the Integer Primary Key column.