Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Data Corruption Issues
 Queries taking very long time

Author  Topic 

mkhenrik
Starting Member

2 Posts

Posted - 2013-09-10 : 06:26:57
Hi!

We have suddenly noticed that some of our queries are taking over one minute to load.

We are running a slightly old version of the CMS Joomla, but it just stopped working a few months ago.

The worst query is this;

SELECT a.id, a.*, CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug, CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as
catslug, a.attribs, a.title, a.introtext as introtext, a.sectionid, a.catid, a.created as created, a.images
FROM jos_content AS a INNER JOIN jos_categories AS cc ON cc.id = a.catid INNER JOIN jos_sections AS d ON d.id = a.sectionid
WHERE (a.state = '1') AND (a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2013-09-09 17:35:10') AND (a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2013-09-09 17:35:10')
AND (d.published = '1') AND (cc.published = '1') AND (a.sectionid IN (6, 7, 40, 59, 50, 60, 28, 57, 24, 55, 32, 56, 36, 58)) AND (a.catid IN (111, 121, 135, 113, 115, 122, 123, 132, 110, 112,
114, 118, 68, 69, 120, 67, 86, 170, 173, 171, 202, 157, 158, 154, 152, 153, 161, 162, 167, 165, 166)) AND a.access <= '0'
ORDER BY a.created DESC
LIMIT 5, 3


It shouldn┤t be taking forever, right?

We have quite a large amount of sections and categories and about 2000 articles that it seeks through.

Can any of you se anything wrong with the query above?
Or does anyone know what could possibly be causing the problem so sudden?

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2013-09-10 : 06:39:05
We are on MS SQL Server only here. Your code looks like MySQL. So maybe our hints wouldn't work for you.
Better try to ask in a MySQL forum


Too old to Rock'n'Roll too young to die.
Go to Top of Page

mkhenrik
Starting Member

2 Posts

Posted - 2013-09-10 : 06:50:16
Oh, sorry :) Thanks
Go to Top of Page
   

- Advertisement -