I have created 100M rows table (292 columns) and run several queries:
mysql> select C2, C10 from T where DAY = ‘2009-12-02’ order by C10 DESC limit 30;
output skipped
+—————————————————————————————————+—————————+
30 rows in set (5 min 1.15 sec)
mysql> select C2, C9 from T where DAY = ‘2009-12-02’ order by C9 DESC limit 30;
output skipped
+—————————————————————————————————+——————+
30 rows in set (0.52 sec)
mysql> SELECT C2, C12 FROM T
-> WHERE (DAY>=‘2009-11-27’) AND (DAY<=‘2009-12-10’)
-> AND C3 = ‘YYYY’
-> AND C4 = ‘04.26.08’
-> AND C7 = ‘XXX ’ AND
-> C8=‘310-410-55502’
-> AND ((C11 > 0 AND C11 IS NOT NULL))
-> ORDER BY C12 DESC LIMIT 30;
output skipped
+—————————————————————————————————+—————————-+
30 rows in set (14 min 3.55 sec)
The first query is on column of type DOUBLE with cardinality ~ 10000
Second query is on INTEGER with low cardinality (512) - and its fast.
The last query is one of our Top N queries. Iostat shows max 2MB/s disk read speed during any query execution for mysql and ‘top’ gives 100% CPU for mysql - this is unusual I would say. I hope that this is configuration (or misconfiguration ) issue. I do observe some very light kswapd0 activity - do not think this might be the reason of a poor query performance. I understand that it is not easy to troubleshoot query performance remotely but may be someone have idea what should I look into?
Hardware:
8 CPU Xeon 54xx; RAM 16GB; 4 SATA 500GB drives (7200)
Software : Linux version 2.6.18-53.el5 ((JavaScript must be enabled to view this email address)) (gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)) #1 SMP Wed Oct 10 16:34:19 EDT 2007
I have not touched any default IB configuration settings. Disks are fast enough - 75MB/s sequential read .
Below are table DDL
CREATE TABLE T (
`C1` varchar(65) DEFAULT NULL,
`C2` varchar(80) DEFAULT NULL, - - this is very large column ~ 3GB compressed
`C3` varchar(256) DEFAULT NULL,
`C4` varchar(128) DEFAULT NULL,
`C5` int(11) DEFAULT NULL,
`C6` varchar(8) DEFAULT NULL,
`C7` varchar(128) DEFAULT NULL,
`C8` varchar(16) DEFAULT NULL,
`C9` int(11) DEFAULT NULL,
`C10` double DEFAULT NULL,
`C11` tinyint(4) DEFAULT NULL,
`C12` tinyint(4) DEFAULT NULL,
`DAY` date DEFAULT NULL,
+ 279 more
) ENGINE=BRIGHTHOUSE DEFAULT CHARSET=latin1
-Vlad
