Hello,
I've got some problems with a statement on ndb (7.09/ubuntu):
select * from kurse1 where wkn = '696960' and datum in (select max(datum) from kurse1 where wkn = '696960' group by substring(datum,1,7) order by datum desc) order by datum desc
With myisam-tables it takes about 10 sec, but with ndb it takes about 3:30min. Can someone explain this to me? What can I do to boost queries like this?
Explain extended says the following:
+----+--------------------+--------+------+----------------------+--------+---------+-------+------+----------+----------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+--------------------+--------+------+----------------------+--------+---------+-------+------+----------+----------------------------------------------+
| 1 | PRIMARY | kurse1 | ref | UNIQUE,WKN_DATUM,WKN | UNIQUE | 8 | const | 10 | 100.00 | Using where |
| 2 | DEPENDENT SUBQUERY | kurse1 | ref | UNIQUE,WKN_DATUM,WKN | UNIQUE | 8 | const | 10 | 100.00 | Using where; Using temporary; Using filesort
Thanks a lot.
I've got some problems with a statement on ndb (7.09/ubuntu):
select * from kurse1 where wkn = '696960' and datum in (select max(datum) from kurse1 where wkn = '696960' group by substring(datum,1,7) order by datum desc) order by datum desc
With myisam-tables it takes about 10 sec, but with ndb it takes about 3:30min. Can someone explain this to me? What can I do to boost queries like this?
Explain extended says the following:
+----+--------------------+--------+------+----------------------+--------+---------+-------+------+----------+----------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+--------------------+--------+------+----------------------+--------+---------+-------+------+----------+----------------------------------------------+
| 1 | PRIMARY | kurse1 | ref | UNIQUE,WKN_DATUM,WKN | UNIQUE | 8 | const | 10 | 100.00 | Using where |
| 2 | DEPENDENT SUBQUERY | kurse1 | ref | UNIQUE,WKN_DATUM,WKN | UNIQUE | 8 | const | 10 | 100.00 | Using where; Using temporary; Using filesort
Thanks a lot.