I have the table products with following fields: code - string, id - integer
My table has over 5 million rows.
In the model I use code:
find(:all, :conditions => ['code = ?', "#{search}"])
It takes 2 seconds to find the result.
Is there any way to reduce search time?
I'm using rails 3.2.11, ruby 1.9.3 and sqlite3 as db
UPD
Changed model code