Re: correct way to simulate 'except' query in mysql 4.1

2007-10-27 Thread Russell Uman
Baron Schwartz wrote: I don't think it will be any better to count distinct values. I think the query is just slow because the index lookups are slow. Is the 'word' column really 150 bytes? huh. it's a varchar(50) on table1 and a varchar(50) on table2. i wonder why explain is reporting

Re: correct way to simulate 'except' query in mysql 4.1

2007-10-27 Thread Baron Schwartz
Russell Uman wrote: Baron Schwartz wrote: I don't think it will be any better to count distinct values. I think the query is just slow because the index lookups are slow. Is the 'word' column really 150 bytes? huh. it's a varchar(50) on table1 and a varchar(50) on table2. i wonder why

Re: correct way to simulate 'except' query in mysql 4.1

2007-10-27 Thread Russell Uman
huh. it's a varchar(50) on table1 and a varchar(50) on table2. i wonder why explain is reporting 150 as key_len? utf8? yes. that does make sense. is there anything else i can investgate? Do you need utf8? :-) yes. it's an internationalized application :) Check your cache hits. I

Re: correct way to simulate 'except' query in mysql 4.1

2007-10-26 Thread Baron Schwartz
I don't think it will be any better to count distinct values. I think the query is just slow because the index lookups are slow. Is the 'word' column really 150 bytes? That's probably the culprit. How slow is this, by the way? 370k rows in one table, verifying the non-existence of index

correct way to simulate 'except' query in mysql 4.1

2007-10-25 Thread Russell Uman
howdy. i trying to find items in one table that don't exist in another. i'm using a left join with a where clause to do it: SELECT t1.field, t2.field FROM table1 t1 LEFT JOIN table2 t2 ON t1.word = t2.word WHERE t2.word IS NULL; both tables are quite large and the query is quite slow. the

Re: correct way to simulate 'except' query in mysql 4.1

2007-10-25 Thread Baron Schwartz
Hi, Russell Uman wrote: howdy. i trying to find items in one table that don't exist in another. i'm using a left join with a where clause to do it: SELECT t1.field, t2.field FROM table1 t1 LEFT JOIN table2 t2 ON t1.word = t2.word WHERE t2.word IS NULL; both tables are quite large and the

Re: correct way to simulate 'except' query in mysql 4.1

2007-10-25 Thread Russell Uman
There's no using distinct, but there is not exists, and in fact no rows are returned. Slow query log reports #Query_time: 94 Lock_time: 0 Rows_sent: 0 Rows_examined: 370220 EXPLAIN: id select_type table type possible_keys key key_len ref rows