Can you please explain, how I can optimize select like this:
SELECT * FROM calls WHERE id_temp % 5 = 0 LIMIT 300000
This select is working on table with 50 millions of records.
Thanks a lot and have a nice day.
Can you please explain, how I can optimize select like this:
This select is working on table with 50 millions of records. Thanks a lot and have a nice day. |
|||
Assuming that You want 300K rows and the chances of a row matching the condition is about 1/5 (under the non-skewed assumption) so it is going to read about 1.5 million rows from the table until it find 300K matches. Even if you have an index on I think your best chances - besides improving disk I/O performance - are if you have the table partitioned using the Another idea is an index with the
or a partial index if you only need the
|
||||
|
id_temp
. this will improve the performance. – Dinup Kandel Jul 3 at 8:43