Re: Improving a query

2004-01-21 Thread Roger Baklund
* Noamn > The query itself executes quite fast, but as it's one of the most > frequently executed queries in the entire program, I thought it > important to make it as fast as possible. Have you considered changing the status column to an ENUM, and drop the status table? (maybe not practical becau

FW: Improving a query

2004-01-20 Thread Noamn
mysql Cc: Noamn Subject: Re: Improving a query * Noamn [...] Please reply to the list. :) > Adding the composite index doesn't make any difference as far as > I can see. > Isn't there a way of forcing a specific index to be used? Yes. From mysql version 4.0.9 you can write

Re: Improving a query

2004-01-20 Thread Roger Baklund
* Noamn [...] Please reply to the list. :) > Adding the composite index doesn't make any difference as far as > I can see. > Isn't there a way of forcing a specific index to be used? Yes. From mysql version 4.0.9 you can write FORCE INDEX, for earlier versions you can try USE INDEX. http://www.

Re: Improving a query

2004-01-20 Thread Roger Baklund
* Noamn [...] > { What does the cardinality mean? There should be three values for matzav, > three for sug and five for status. Is this zero based? } It is the expected number of different values in this column. The number is not accurate. You can run ANALYZE TABLE to update this information. ht

RE: Improving a query

2004-01-20 Thread Noamn
PRIMARY | 3 | p.sochen |1 | | +-+++--+-+-- +--+-+ 3 rows in set (0.00 sec) -Original Message- From: Roger Baklund [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 20, 2004 3:33 PM To: Cc: Noamn Subject: Re: Improving a query * Noamn > I have a query which was

Re: Improving a query

2004-01-20 Thread Roger Baklund
* Noamn > I have a query which was written like this > select p.id, p.name, p.money, s.name, agents.name > from projects p, status s, agents > where p.stage = 0 > and p.status = s.id > and p.agent = agents.id > order by p.name > > Despite the fact that p.name is indexed, 'explain' shows in the > ex

Improving a query

2004-01-20 Thread Noamn
I have a query which was written like this select p.id, p.name, p.money, s.name, agents.name from projects p, status s, agents where p.stage = 0 and p.status = s.id and p.agent = agents.id order by p.name Despite the fact that p.name is indexed, 'explain' shows in the extra column 'using temporary