Hello, I have a table of 26 million rows that I need to query. The table
is a keywords database with the keyword and a pointer to what page it
came off of. (pageid|keyword) The problem is that when I use the
following query is the group by make the query take about 14 seconds to
do. However, if I remove the group by portion it finishes the query in
less then .10.
Here is the query:
SELECT count(pageid) as n, pageid FROM keywords left join
deleted_keywords on keywords.keyid = deleted_keywords.keyid where
deleted_keywords.keyid is null and (keyword = 'Big' OR keyword =
'Brown') group by pageid having n = 2 limit 100;
I need to be able to query the database and only return pageid's of
pages that have every word on it. The left join is used so that I do not
have to delete from the database all day, I just do a flush once a day
in the wee morning hours. This table gets queried about 600 times a
second, so having a 14 second query creates such a backlog that the
system becomes unusable.
Any help would be really appreciated.
Thanks
PS - keyword is an indexed feild.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php