Re: query optimization suggestion

2001-02-01 Thread Dan Nelson
In the last episode (Feb 01), Michael Griffith said: > CREATE TABLE test( > userID int, # (non-unique) > testID int, # (non-unique) > PRIMARY key(testid,userid) > ); > > Suppose this table is populated with 1,000,000 rows. Then do this: > > DELETE FROM test WHERE userID= AND

Re: query optimization suggestion

2001-02-01 Thread Michael Griffith
> Shouldn't the first query have parenthesis? As in: > DELETE FROM test WHERE userID=X AND (testID<20 OR > testID>80); > Even if it works the other way, parenthesis make it more clear what > you're trying to accomplish. > -Angela Actually, yes. Sorry about the poor example. My point

Re: query optimization suggestion

2001-02-01 Thread Angela
Shouldn't the first query have parenthesis? As in: DELETE FROM test WHERE userID=X AND (testID<20 OR testID>80); Even if it works the other way, parenthesis make it more clear what you're trying to accomplish. -Angela Michael Griffith wrote: > > When using mySQL I've learned to avoid

query optimization suggestion

2001-02-01 Thread Michael Griffith
When using mySQL I've learned to avoid OR in any queries as much as possible . Almost always this causes a major speed decrease. Consider this table: CREATE TABLE test( userID int, # (non-unique) testID int, # (non-unique) PRIMARY key(testid,userid) ); Suppose this table is popul