i have a small doubt.
if i write combine query in Model.find() WITH limit & offset to get 10
records per hit .but my friend told that when to get last 10 records
then the time will be same as to get Model.find() WITHOUT limit &
offset.
he told like that ,the data base will create a temp table to keep our
(query result table) then it will get corresponding number of records
from the new table like records (0…10,10…20,20…30…).then he
told by this way to get last 10 records ,it will be same time as
ordinary Model.find() WITHOUT limit & offset
It’s quite possible for mysql to materialize temporary tables for the
purpose of evaluating a query. With any if these things you can always
ask the database (on mysql EXPLAIN SELECT * from foos limit 100,200)
what it would do.
If your find clause also has a sort order then you’d better have an
index on that column or it could be dog slow (since then the database
has to sort the entire table to find the top 10 records).
It’s quite possible for mysql to materialize temporary tables for the
purpose of evaluating a query. With any if these things you can always
ask the database (on mysql EXPLAIN SELECT * from foos limit 100,200)
what it would do.
If your find clause also has a sort order then you’d better have an
index on that column or it could be dog slow (since then the database
has to sort the entire table to find the top 10 records).
Fred
so is it it is possible in mysql.
for other database adapter will it be fast ? is it ?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.