Forum Moderators: open
Here is an example of query
EXPLAIN SELECT count( id )
FROM link_feeds
WHERE (
(
feed_url = 'http://www.domain.com/articles/2008/01/25/sports'
OR feed_title = 'KENTUCKY BASKETBALL: Some text here that we are looking for'
)
AND ( 13683 )
IN (
SELECT rssid
FROM category_rss
WHERE cat_id =340
)
)
explain:
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY link_feeds ALL titleindx NULL NULL NULL 946857 Using where
2 DEPENDENT SUBQUERY category_rss const PRIMARY,cat_id PRIMARY 2 1
thanks in advance..
there are index's on all pats of table, id is primary key in tables..
B
the others are indexes...
Indexes:
Keyname Type Cardinality Action Field
PRIMARY PRIMARY 953584 Edit Drop id
rss_id INDEX 4414 Edit Drop rss_id
pub_date INDEX 476792 Edit Drop pub_date
hits INDEX 312 Edit Drop hits
titleindx INDEX 953584 Edit Drop feed_title 255
other table is
cat_id INDEX 281 Edit Drop cat_id
this is super fast with just the feed_title and not url too..
Thanks for your help!
was missing index on url...fixed by splitting them up though the or parts...why does it take so long together?
Just a guess...
You are using an 'or' on two different fields. Even iff there are indexes on both fields it can't use both indexes at the same time.
Since you are 'And'ing the result to another clause I would guess it 1st has to find all results of the 'or' instead of quitting when it finds the 1st which means a table scan.
Andy