а может и нет. в любом случае - посещаемость возрасла и я заметил что таблица постоянно пилиться...
начал ковыряться - а тут такое
Код: Выделить всё
mysql> desc counter_segodnya;
+-----------------+-------------+------+-----+------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+-------------+------+-----+------------+----------------+
| id_zapisi | int(15) | NO | PRI | NULL | auto_increment |
| chislo | date | NO | | 0000-00-00 | |
| vremya | time | NO | | 00:00:00 | |
| vizit_timestamp | int(16) | NO | MUL | 0 | |
| random_for_jaba | varchar(64) | NO | MUL | 0 | |
| ip | varchar(15) | NO | MUL | | |
| page | int(5) | NO | | 0 | |
| user_agent | text | NO | | NULL | |
| referer | text | NO | | NULL | |
| screen_width | int(6) | NO | | 0 | |
| screen_height | int(6) | NO | | 0 | |
| user_color | int(6) | NO | | 0 | |
| word_counter | int(1) | NO | MUL | 0 | |
+-----------------+-------------+------+-----+------------+----------------+
13 rows in set (0.00 sec)
mysql> explain SELECT COUNT(DISTINCT `ip`) AS `IP_this_day` FROM `counter_segodnya1` WHERE `vizit_timestamp` > '1271361600';
+----+-------------+-------------------+------+-----------------+------+---------+------+--------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------------------+------+-----------------+------+---------+------+--------+-------------+
| 1 | SIMPLE | counter_segodnya1 | ALL | vizit_timestamp | NULL | NULL | NULL | 106413 | Using where |
+----+-------------+-------------------+------+-----------------+------+---------+------+--------+-------------+
1 row in set (0.00 sec)
Код: Выделить всё
mysql> explain SELECT COUNT(DISTINCT `ip`) AS `IP_this_day` FROM `counter_segodnya1` WHERE IP='123';
+----+-------------+-------------------+------+---------------+------+---------+-------+------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------------------+------+---------------+------+---------+-------+------+--------------------------+
| 1 | SIMPLE | counter_segodnya1 | ref | ip | ip | 17 | const | 1 | Using where; Using index |
+----+-------------+-------------------+------+---------------+------+---------+-------+------+--------------------------+
1 row in set (0.00 sec)
mysql>