RE: Slow updates with two keys in where.

2002-01-24 Thread Andrew Schmidt
MySQL can only use 1 index per query. So take your first query for example: update forum set approved='N' where id=644122 or thread=644122 it can only use the id key OR the thread key, not both. and since you have an 'or' in your query MySQL must scan the entire table for either id being

Re: Slow updates with two keys in where.

2002-01-24 Thread Brian Moon
Is this just something we have to live with or does MySQL 4 handle this better? Brian. - Original Message - From: Andrew Schmidt [EMAIL PROTECTED] To: Brian Moon [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, January 24, 2002 3:11 PM Subject: RE: Slow updates with two keys

Re: Slow updates with two keys in where.

2002-01-24 Thread Steven Roussey
Is this just something we have to live with or does MySQL 4 handle this better? Something to live with. Someday, I'm sure MySQL will optimize this case. Conceptually its not that hard. You split it into multiple queries that track an index. If it is a select, you also UNION the results back

Re: Slow updates with two keys in where.

2002-01-24 Thread Jeremy Zawodny
On Thu, Jan 24, 2002 at 07:34:14PM -0800, Steven Roussey wrote: In honor of Jeremy: MySQL 3.23.47-log: up 5 days, processed 595,464,211 queries (1,350/sec. avg) :) Very nice! Fast and using a recent version. I really need to upgrade one of these days. I keep meaning to get my slaves up