> Creating a combined index can help MySQL in using this index for both the
> where condition and the order by clause.
> Try the query with an index on cat,date and with date,cat; maybe one will
be
> faster than the other.
This partially solved my problem. Thanks a lot. However I am facing a new
p
> Create composite index on (cat, date). Use EXPLAIN to see if MySQL uses
index:
> http://dev.mysql.com/doc/mysql/en/EXPLAIN.html
This partially solved my problem. Thanks a lot. However I am facing a new
problem here.
The query where I am ordering by a column is much more slowly than the same
que
> 1. MySQL only uses one index for each table in a JOIN; this query only
uses
> one table, so only one index is used.
> 2. DESC is slower than ASC
> 3. Try creating an index on two columns; try cat and date, and try date
and
> cat.
> 4. Check EXPLAIN SELECT id,name.. to see whether the right in
> select id,name,desc,cat,date from table where cat='12'
>
> however I need to order the results by date desc... I have indexes on both
> the cat and date (of type timestamp) fields however this operation is much
> more slowly when I used the order So the result is something like this
>
> selec
"Arthur Radulescu" <[EMAIL PROTECTED]> wrote:
>
> I have a simple query on a table of about 1,000,000 records... The table is
> optimized and the query is pretty simple at this moment... something like
> this
>
> select id,name,desc,cat,date from table where cat='12'
>
> however I need to order
Hello!
I have a simple query on a table of about 1,000,000 records... The table is
optimized and the query is pretty simple at this moment... something like
this
select id,name,desc,cat,date from table where cat='12'
however I need to order the results by date desc... I have indexes on both
the
Hello!
I have a simple query on a table of about 1,000,000 records... The table is
optimized and the query is pretty simple at this moment... something like
this
select id,name,desc,cat,date from table where cat='12'
however I need to order the results by date desc... I have indexes on both
the