two tables are as follows .
CREATE TABLE `table_a` ( `id` int(11) NOT NULL, `col1` date NOT NULL, PRIMARY KEY (`id`), KEY `col1` (`col1`))
CREATE TABLE `table_b` ( `id` int(11) NOT NULL, `col1` varchar(255) NOT NULL, PRIMARY KEY (`id`))
and then a query is
select a.id, b.col1, a.col1 from table_a a, table_b b where a.id=b.id order by a.col1 desc;
this query always does filesort. why?
col1 column on table_a is arleady indexed.
does simple 'order by' query on joined tables always filesort?
how can i prevent mysql from filesorting.
help me please..
CREATE TABLE `table_a` ( `id` int(11) NOT NULL, `col1` date NOT NULL, PRIMARY KEY (`id`), KEY `col1` (`col1`))
CREATE TABLE `table_b` ( `id` int(11) NOT NULL, `col1` varchar(255) NOT NULL, PRIMARY KEY (`id`))
and then a query is
select a.id, b.col1, a.col1 from table_a a, table_b b where a.id=b.id order by a.col1 desc;
this query always does filesort. why?
col1 column on table_a is arleady indexed.
does simple 'order by' query on joined tables always filesort?
how can i prevent mysql from filesorting.
help me please..
Comment