Query take too long time - please help!

2012-07-10 Thread Darek Maciera
Hello, I have table: mysql DESCRIBE books; |id |int(255) | NO | PRI | NULL | auto_increment | | idu | int(255) | NO | MUL | NULL | ksd | char(15) | YES |

Re: Query take too long time - please help!

2012-07-10 Thread Ananda Kumar
can u show the explain plan for your query On Tue, Jul 10, 2012 at 2:59 PM, Darek Maciera darekmaci...@gmail.comwrote: Hello, I have table: mysql DESCRIBE books; |id |int(255) | NO | PRI | NULL | auto_increment | | idu

Fwd: Query take too long time - please help!

2012-07-10 Thread Darek Maciera
2012/7/10 Ananda Kumar anan...@gmail.com: can u show the explain plan for your query Thanks, for reply! Sure: mysql EXPLAIN SELECT * FROM books WHERE LOWER(ksd)=LOWER('4204661375');

Re: Query take too long time - please help!

2012-07-10 Thread Ananda Kumar
you are using a function-LOWER, which will not make use of the unique key index on ksd. Mysql does not support function based index, hence your query is doing a FULL TABLE scan and taking more time. On Tue, Jul 10, 2012 at 4:46 PM, Darek Maciera darekmaci...@gmail.comwrote: 2012/7/10 Ananda

Re: Fwd: Query take too long time - please help!

2012-07-10 Thread Carsten Pedersen
On 10.07.2012 13:16, Darek Maciera wrote: 2012/7/10 Ananda Kumar anan...@gmail.com: can u show the explain plan for your query Thanks, for reply! Sure: mysql EXPLAIN SELECT * FROM books WHERE LOWER(ksd)=LOWER('4204661375'); That's definitely not the query you showed the first time

why does select * from table oder by indexed_field not use key?

2012-07-10 Thread Reindl Harald
my reason for create a key on qg_sort was primary for this query - but why is here 'filesort' used? mysql EXPLAIN SELECT * FROM cms1_quickbar_groups ORDER BY qg_sort ASC; ++-+--+--+---+--+-+--+--++ | id |

Composite Index Usage in Joins

2012-07-10 Thread Jeffrey Grollo
Hi, I’m attempting to optimize a join and am having a difficult time using multiple columns from a composite index. The second column of the composite key is being used when tested for equality, but not for IN or BETWEEN criteria. As an example, say that I’m searching two tables: portfolio and

Re: why does select * from table oder by indexed_field not use key?

2012-07-10 Thread Akshay Suryavanshi
Hi, The statement will do a Full table scan, because of the following things : Not using Where clause, and selecting all columns (*) within the query. Filesort is used since no index is used, use a where clause with condition on column which is indexed and notice the explain plan. Also you can