Quantcast
Channel: MySQL Forums - InnoDB
Viewing all articles
Browse latest Browse all 1954

both Index and query are very slow for huge number of data in the tables (1 reply)

$
0
0
I am using Linux_64 as the server. I need to do the statistics for the data over the specific time period.

Here is the problem I encountered: we have the existing tables with quite big number (531,576,443) of existing data. The following queries seem to take forever:
mysql> CREATE INDEX cal_name_index ON table1(cal_name);

mysql> select count(*) from table1 where table2_id in (select id from table2 where cal_name=desired_name and table3_id in (select id from table3 where date > '2010-11-27 00:00:00' and date < '2010-12-04 00:00:00'));

mysql> select * from table1 where table2_id in (select id from table2 where cal_name=desired_name and table3_id in (select id from table3 where date > '2010-11-27 00:00:00' and date < '2010-12-04 00:00:00')) limit 1;

It will be greatly appreciated if someone can give some suggestions for speeding up the fetching.

Viewing all articles
Browse latest Browse all 1954

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>