In my mysql_slowquery.log I see constant records:
Code: Select all
# Time: 080117 10:48:06
# User@Host: cactiuser[cactiuser] @ localhost []
# Query_time: 80 Lock_time: 0 Rows_sent: 0 Rows_examined: 1532615
REPLACE INTO mac_track_scan_dates (SELECT DISTINCT scan_date from mac_track_ports);
Code: Select all
mysql> SELECT DISTINCT scan_date from mac_track_ports;
+---------------------+
| scan_date |
+---------------------+
| 2008-01-29 01:13:07 |
| 2008-01-29 01:22:27 |
| 2008-01-29 01:34:54 |
| 2008-01-29 01:43:33 |
| 2008-01-29 01:52:28 |
| 2008-01-29 02:07:40 |
| 2008-01-29 02:14:47 |
............................................
| 2008-02-12 18:06:39 |
+---------------------+
1738 rows in set (25.60 sec)
Code: Select all
ALTER TABLE `mac_track_ports` ADD INDEX `scan_date` USING BTREE(`scan_date`);
Code: Select all
mysql> SELECT DISTINCT scan_date from mac_track_ports;
+---------------------+
| scan_date |
+---------------------+
| 2008-01-29 01:13:07 |
| 2008-01-29 01:22:27 |
| 2008-01-29 01:34:54 |
| 2008-01-29 01:43:33 |
| 2008-01-29 01:52:28 |
.......................................
| 2008-02-12 17:53:10 |
| 2008-02-12 18:06:39 |
| 2008-02-12 18:17:09 |
+---------------------+
1739 rows in set (0.01 sec)