Re: How to avoid Using temporary; Using filesort

2009-01-14 Thread Johan Thorvaldsson
Not really, the query took 4-5 seconds. The query runs through 13910 rows according to explain, that isnt alot is it? SELECT COUNT(*) antal,ad.ad_id FROM ad INNER JOIN tag_ad_map tm ON tm.ad_id=ad.ad_id WHERE tm.tag_id IN (99, 10807, 20728, 21, 135) AND ad.is_removed = 0 AND ad.is_active=1 AND

How to avoid Using temporary; Using filesort

2009-01-14 Thread Johan Thorvaldsson
I have a query that runs very slow and using Using temporary; Using filesort. Is there a way to avoid them using current table structure? Goal with the query is to find ads (ad_id) that have tags (tag_id) connected to them, order by "antal" is used to get the most relevant first. ( the one that con

Re: Why dont my query use the index keys?

2008-09-17 Thread Johan Thorvaldsson
ort_buffer_size by using the command show global variables like 'sort%'; Regards, Pradeep Chandru. Johan Thorvaldsson wrote: - Montania System AB Halmstad http://www.montania.se Johan Thorvaldsson [EMAIL PROT

Re: Query runs very sloooow

2008-03-05 Thread Johan Thorvaldsson
NULL default '0', PRIMARY KEY (`id`), KEY `url` (`url`) ) ENGINE=MyISAM AUTO_INCREMENT=11374 DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci 2008/3/5, Baron Schwartz <[EMAIL PROTECTED]>: > > Hi, > > > On Wed, Mar 5, 2008 at 9:11 AM, Johan Thorvaldsson <[EMAIL

Re: Query runs very sloooow

2008-03-05 Thread Johan Thorvaldsson
SIMPLE tm2 eq_ref PRIMARY PRIMARY 8 rubbetdev.t2.id,rubbetdev.tm1.ad_id 1 Using where; Using index 2008/3/5, Baron Schwartz <[EMAIL PROTECTED]>: > > Hi, > > > On Wed, Mar 5, 2008 at 9:11 AM, Johan Thorvaldsson <[EMAIL PROTECTED]> > wrote: > > I need help to optimiz

Query runs very sloooow

2008-03-05 Thread Johan Thorvaldsson
I need help to optimize this following query. It runs very slow and I cant find any direct errors in it. SELECT 1 * t1.termfreq as viktatantal, t1.tag, t1.url FROM tag_keys t1 LEFT JOIN tag_ad_map tm1 ON t1.id = tm1.tag_id LEFT JOIN tag_ad_map tm2 ON tm1.ad_id = tm2.ad_id LEFT JOIN tag_keys t2 ON t