How can mysql use ts
index in this query? (EXTRA: Using where; Using index)
EXPLAIN SELECT * FROM times
WHERE UNIX_TIMESTAMP(CONVERT_TZ(FROM_UNIXTIME(ts), 'GMT', 'EET')) > 10000;
| ID | SELECT_TYPE | TABLE | TYPE | POSSIBLE_KEYS | KEY | KEY_LEN | REF | ROWS | EXTRA |
|----|-------------|-------|-------|---------------|---------|---------|--------|------|--------------------------|
| 1 | SIMPLE | times | index | (null) | PRIMARY | 4 | (null) | 10 | Using where; Using index |
The schema:
CREATE TABLE times(
ts int(11) NOT NULL COMMENT 'timestamp',
PRIMARY KEY (ts)
);
INSERT INTO times VALUES (0), (1000), (5000), (10000), (15000),
(20000), (600000), (7000000), (80000000), (900000000);
SQL fiddle link: http://sqlfiddle.com/#!9/6aa3d/8
MySQL uses index. Why and how?
Could you provide me with MySQL documentation page describing this feature?
>
operator