Before I go any further, let me just say, I've already done everything that's recommended when you google "slow joomla" or "optimize joomla". That is, my site is GZipped, all of my css and js are optimized and minified, I'm not running any unnecessary components, plugins, or modules (hardly any, in fact), my images are optimized, caching is turned on (both page and Progressive) and I'm on supah-fast cloud hosting from Rackspace, with my SQL Database on a separate Rackspace server.
All of that, and I'm still getting load times upwards of 10-12 seconds, sometimes as much as 14-15.
From Joomla debug:
Application 0.000 seconds (+0.000); 0.75 MB (+0.755) - afterLoad
Application 0.027 seconds (+0.027); 2.25 MB (+1.491) - afterInitialise
Application 0.040 seconds (+0.013); 3.26 MB (+1.010) - afterRoute
Application 11.986 seconds (+11.947); 5.09 MB (+1.833) - afterDispatch
Application 12.000 seconds (+0.014); 5.63 MB (+0.539) - beforeRenderModule mod_chronoforms (Tip Line)
Application 12.006 seconds (+0.005); 5.85 MB (+0.225) - afterRenderModule mod_chronoforms (Tip Line)
Application 12.008 seconds (+0.002); 5.86 MB (+0.006) - beforeRenderModule mod_custom_advanced (Sponsors)
Application 12.009 seconds (+0.002); 5.88 MB (+0.019) - afterRenderModule mod_custom_advanced (Sponsors)
Application 12.010 seconds (+0.001); 5.87 MB (-0.006) - beforeRenderModule mod_flexi_customcode (Popular Now)
Application 12.012 seconds (+0.002); 5.89 MB (+0.018) - afterRenderModule mod_flexi_customcode (Popular Now)
Application 12.012 seconds (+0.001); 5.84 MB (-0.046) - beforeRenderModule mod_articles_category (Featured Articles)
Application 12.033 seconds (+0.021); 5.97 MB (+0.127) - afterRenderModule mod_articles_category (Featured Articles)
Application 12.033 seconds (+0.000); 5.96 MB (-0.014) - beforeRenderModule mod_search (Search)
Application 12.036 seconds (+0.002); 5.98 MB (+0.022) - afterRenderModule mod_search (Search)
Application 12.036 seconds (+0.001); 5.93 MB (-0.050) - beforeRenderModule mod_acymailing (AcyMailing Module)
Application 12.044 seconds (+0.007); 6.44 MB (+0.507) - afterRenderModule mod_acymailing (AcyMailing Module)
Application 12.157 seconds (+0.114); 6.72 MB (+0.289) - afterRender
the (+11.947) for afterDispatch is what tipped me off that it was probably an issue with the MySQL queries, so I started running some of the long (long, LONG) ones through PHPMyAdmin.
I found that queries such as these (the first of which loads 8 articles for the category-blog view -- as far as I understand, the second does the same search, minus the LIMIT, to allow for pagination) take over 2 or 3 second EACH to complete and there are 40-some-odd queries (though the vast majority are nowhere near as unwieldy) every time a page loads:
SELECT a.id, a.title, a.alias, a.introtext, a.checked_out, a.checked_out_time, a.catid, a.created, a.created_by, a.created_by_alias,
CASE WHEN a.modified = '0000-00-00 00:00:00' THEN a.created ELSE a.modified END as modified, a.modified_by, uam.name as modified_by_name,
CASE WHEN a.publish_up = '0000-00-00 00:00:00' THEN a.created ELSE a.publish_up END as publish_up,a.publish_down, a.images, a.urls, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, a.hits, a.xreference, a.featured, LENGTH(a.fulltext) AS readmore,
CASE WHEN badcats.id is not null THEN 0 ELSE a.state END AS state,c.title AS category_title, c.path AS category_route, c.access AS category_access, c.alias AS category_alias,
CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author,ua.email AS author_email,contact.id as contactid,parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias,ROUND(v.rating_sum / v.rating_count, 0) AS rating, v.rating_count as rating_count,c.published,
CASE WHEN badcats.id is null THEN c.published ELSE 0 END AS parents_published
FROM mydatabase_content AS a
LEFT JOIN mydatabase_content_frontpage AS fp
ON fp.content_id = a.id
LEFT JOIN mydatabase_categories AS c
ON c.id = a.catid
LEFT JOIN mydatabase_users AS ua
ON ua.id = a.created_by
LEFT JOIN mydatabase_users AS uam
ON uam.id = a.modified_by
LEFT JOIN ( SELECT contact.user_id, MAX(contact.id) AS id, contact.language
FROM mydatabase_contact_details AS contact
WHERE contact.published = 1
GROUP BY contact.user_id, contact.language) AS contact
ON contact.user_id = a.created_by
LEFT JOIN mydatabase_categories as parent
ON parent.id = c.parent_id
LEFT JOIN mydatabase_content_rating AS v
ON a.id = v.content_id
LEFT
OUTER JOIN (SELECT cat.id as id
FROM mydatabase_categories AS cat JOIN mydatabase_categories AS parent
ON cat.lft BETWEEN parent.lft
AND parent.rgt
WHERE parent.extension = 'com_content'
AND parent.published != 1
GROUP BY cat.id ) AS badcats
ON badcats.id = c.id
WHERE a.access IN (1,1,5)
AND c.access IN (1,1,5)
AND
CASE WHEN badcats.id is null THEN a.state ELSE 0 END = 1
AND (a.catid = 164 OR a.catid IN ( SELECT sub.id
FROM mydatabase_categories as sub
INNER JOIN mydatabase_categories as this
ON sub.lft > this.lft
AND sub.rgt < this.rgt
WHERE this.id = 164))
AND (a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2013-08-07 07:00:01')
AND (a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2013-08-07 07:00:01')
GROUP BY a.id, a.title, a.alias, a.introtext, a.checked_out, a.checked_out_time, a.catid, a.created, a.created_by, a.created_by_alias, a.created, a.modified, a.modified_by, uam.name, a.publish_up, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, a.hits, a.xreference, a.featured, a.fulltext, a.state, a.publish_down, badcats.id, c.title, c.path, c.access, c.alias, uam.id, ua.name, ua.email, contact.id, parent.title, parent.id, parent.path, parent.alias, v.rating_sum, v.rating_count, c.published, c.lft, a.ordering, parent.lft, fp.ordering, c.id, a.images, a.urls
ORDER BY
CASE WHEN a.publish_up = '0000-00-00 00:00:00' THEN a.created ELSE a.publish_up END DESC , a.created
LIMIT 0, 7
---
SELECT a.id, a.title, a.alias, a.introtext, a.checked_out, a.checked_out_time, a.catid, a.created, a.created_by, a.created_by_alias,
CASE WHEN a.modified = '0000-00-00 00:00:00' THEN a.created ELSE a.modified END as modified, a.modified_by, uam.name as modified_by_name,
CASE WHEN a.publish_up = '0000-00-00 00:00:00' THEN a.created ELSE a.publish_up END as publish_up,a.publish_down, a.images, a.urls, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, a.hits, a.xreference, a.featured, LENGTH(a.fulltext) AS readmore,
CASE WHEN badcats.id is not null THEN 0 ELSE a.state END AS state,c.title AS category_title, c.path AS category_route, c.access AS category_access, c.alias AS category_alias,
CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author,ua.email AS author_email,contact.id as contactid,parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias,ROUND(v.rating_sum / v.rating_count, 0) AS rating, v.rating_count as rating_count,c.published,
CASE WHEN badcats.id is null THEN c.published ELSE 0 END AS parents_published
FROM mydatabase_content AS a
LEFT JOIN mydatabase_content_frontpage AS fp
ON fp.content_id = a.id
LEFT JOIN mydatabase_categories AS c
ON c.id = a.catid
LEFT JOIN mydatabase_users AS ua
ON ua.id = a.created_by
LEFT JOIN mydatabase_users AS uam
ON uam.id = a.modified_by
LEFT JOIN ( SELECT contact.user_id, MAX(contact.id) AS id, contact.language
FROM mydatabase_contact_details AS contact
WHERE contact.published = 1
GROUP BY contact.user_id, contact.language) AS contact
ON contact.user_id = a.created_by
LEFT JOIN mydatabase_categories as parent
ON parent.id = c.parent_id
LEFT JOIN mydatabase_content_rating AS v
ON a.id = v.content_id
LEFT
OUTER JOIN (SELECT cat.id as id
FROM mydatabase_categories AS cat JOIN mydatabase_categories AS parent
ON cat.lft BETWEEN parent.lft
AND parent.rgt
WHERE parent.extension = 'com_content'
AND parent.published != 1
GROUP BY cat.id ) AS badcats
ON badcats.id = c.id
WHERE a.access IN (1,1,5)
AND c.access IN (1,1,5)
AND
CASE WHEN badcats.id is null THEN a.state ELSE 0 END = 1
AND (a.catid = 164 OR a.catid IN ( SELECT sub.id
FROM mydatabase_categories as sub
INNER JOIN mydatabase_categories as this
ON sub.lft > this.lft
AND sub.rgt < this.rgt
WHERE this.id = 164))
AND (a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2013-08-07 07:00:01')
AND (a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2013-08-07 07:00:01')
GROUP BY a.id, a.title, a.alias, a.introtext, a.checked_out, a.checked_out_time, a.catid, a.created, a.created_by, a.created_by_alias, a.created, a.modified, a.modified_by, uam.name, a.publish_up, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, a.hits, a.xreference, a.featured, a.fulltext, a.state, a.publish_down, badcats.id, c.title, c.path, c.access, c.alias, uam.id, ua.name, ua.email, contact.id, parent.title, parent.id, parent.path, parent.alias, v.rating_sum, v.rating_count, c.published, c.lft, a.ordering, parent.lft, fp.ordering, c.id, a.images, a.urls
ORDER BY
CASE WHEN a.publish_up = '0000-00-00 00:00:00' THEN a.created ELSE a.publish_up END DESC , a.created
EDIT
Here's the EXPLAIN for the first query:
And for the second:
My _content table is a little over 14,000 rows, which I know isn't really all that much in the grand scheme of things.
/EDIT
Has anyone found a good way to optimize this? I'm not opposed to hacking the core (I know they say not to, but what's the point of an open source project if you can't get in and fiddle with it?) if that's what it takes.
EDIT 2 - SOLVED (sort of).
So, I found this guy who seems to be going down the right path, so I said to hell with it, and tried it.
In components/com_content/models/articles.php, I replaced line 431
$query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')')
->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')');
with
$query->where('(a.publish_up >= DATE_SUB(NOW(), INTERVAL 1 YEAR))');
I know this won't work for everyone, as it probably breaks pagination, but it seems to be working for me so far (my template uses a js infinite scroll solution instead of pagination). I figure if anyone is looking for an article over a year old, they can use the Search function.
Those two queries now each take less that .04 seconds to complete, and the afterDispatch time from Joomla Debug is down to 1.469 seconds -- not optimal, but a number I can live with and continue to whittle down.
I know this solution is pretty hacky, and probably won't work for anyone else, so I'd love to hear more ideas about improving/optimizing the Joomla core and the Joomla stock queries.
Thanks SO!
/EDIT 2
As I have posted here already: JOOMLA site too slow
I uncommented the
bind-address="127.0.0.1"
setting in the MySQL configuration file (my.ini).
This brought an increase of execution speed to my local Joomla installation on Windows 8.1.
There is an issue with the join on the contact table and the resulting group_by.
This is fixed in master with https://github.com/joomla/joomla-cms/pull/1542 and I think it should already be included in the current release.
Which version of Joomla are you using?
i had a problem on windwos hosting php+mysql. set host to ip address.
host 127.0.0.1
Related
We are running OpenCart store and now we have to export order data for 6 months (around 17K orders).
Opencart has a builtin solution, when you select the orders you need and export, but it works fine with less than 500 orders.
I've decided to make a standalone script based on the query it uses for its original export.
I'm not publishing the export part, since my dedicated server and the store freezes when I run the following query and consequent loop for mysql_fetch_assoc.
$query = "SELECT o.*, op.name, op.model,op.order_product_id, op.product_id, op.quantity, op.price, op.total AS ptotal, op.tax,
(SELECT ot.value FROM order_total ot WHERE ot.order_id = o.order_id AND ot.code = 'sub_total') AS sub_total,
(SELECT ot.value FROM order_total ot WHERE ot.order_id = o.order_id AND ot.code = 'credit') AS store_credit,
(SELECT `name` FROM order_history oh INNER JOIN `order_status` os on oh.order_status_id=os.order_status_id WHERE oh.order_id = o.order_id and os.language_id='2'
ORDER BY order_history_id DESC LIMIT 1) as order_status
FROM `order` o inner join `order_product` op on o.order_id=op.order_id WHERE o.date_added BETWEEN '2014-01-01 00:00:00' AND '2014-06-30 03:59:59'";
$sql = mysql_query($query);
do {
echo $o['model']."<br/>"; // here we will have a part using PEAR Excel basically
} while ($o=mysql_fetch_assoc($sql));
$endtime = microtime();
echo $endtime-$starttime;
Indexes are set. Additional index was set on oh.order_id. No luck. The same request for 1 particular order id runs in 0.003ms.
My process list shows "Sending data" for the above shown query and "Waiting for table level lock" for anothers.
Could you kindly assist?
I think you could optimize your SQL a bit to prevent locks. The following might help, but recognize that I don't have your schema or data to test this on, so you may need to tweak.
SELECT o.*, op.name, op.model,op.order_product_id, op.product_id,
op.quantity, op.price, op.total AS ptotal, op.tax,
ot.sub_total, ot.store_credit, os.os_name
FROM `order` o inner join `order_product` op on o.order_id=op.order_id
INNER JOIN (SELECT t.order_id,
MAX(case when t.code = 'sub_total' t.value else 0 end case) as sub_total,
MAX(case when t.code = 'credit' t.value else 0 end case) as store_credit
FROM order_total t GROUP BY t.order_id) ot ON ot.order_id = o.order_id
INNER JOIN (SELECT * FROM (SELECT oh.order_id, `name` AS os_name
FROM order_history oh
INNER JOIN `order_status` s on oh.order_status_id=s.order_status_id
WHERE s.language_id='2' ORDER BY order_history_id DESC) t1
GROUP BY t1.order_id) as os ON os.order_id = o.order_id
WHERE o.date_added BETWEEN '2014-01-01 00:00:00' AND '2014-06-30 03:59:59'
I would also probably do a create temp table temp_order_history from select ... and then select * from temp_order_history Also, you may need to do outer join instead of inner join if either of those sub selects have missing data. In those cases, you'd just get NULLs for those columns.
My website is experiencing very slow queries like the one below. It is Joomla 2.5.
# Query_time: 19.797091 Lock_time: 0.000561 Rows_sent: 12 Rows_examined: 4127
SET timestamp=1385467501;
SELECT a.fulltext, a.id, a.title, a.alias, a.title_alias, a.introtext, a.state, a.catid, a.created, a.created_by, a.created_by_alias,a.images, a.modified, a.modified_by,a.publish_up, a.publish_down, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, a.hits, a.featured, LENGTH(a.fulltext) AS readmore,a.fulltext, a.id, a.title, a.alias, a.title_alias, a.introtext, a.state, a.catid, a.created, a.created_by, a.created_by_alias,a.images, a.modified, a.modified_by,a.publish_up, a.publish_down, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, a.hits, a.featured, LENGTH(a.fulltext) AS readmore,c.title AS category_title, c.path AS category_route, c.access AS category_access, c.alias AS category_alias,CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author,ua.email AS author_email,contact.id as contactid,parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias,ROUND(v.rating_sum / v.rating_count, 0) AS rating, v.rating_count as rating_count,c.published, CASE WHEN badcats.id is null THEN c.published ELSE 0 END AS parents_published
FROM j25_content AS a
LEFT JOIN j25_content_frontpage AS fp ON fp.content_id = a.id
LEFT JOIN j25_categories AS c ON c.id = a.catid
LEFT JOIN j25_users AS ua ON ua.id = a.created_by
LEFT JOIN j25_users AS uam ON uam.id = a.modified_by
LEFT JOIN (
SELECT contact.user_id, MAX(contact.id) AS id, contact.language
FROM j25_contact_details AS contact
WHERE contact.published = 1
GROUP BY contact.user_id, contact.language) AS contact ON contact.user_id = a.created_by
LEFT JOIN j25_categories as parent ON parent.id = c.parent_id
LEFT JOIN j25_content_rating AS v ON a.id = v.content_id
LEFT OUTER JOIN (SELECT cat.id as id FROM j25_categories AS cat JOIN j25_categories AS parent ON cat.lft BETWEEN parent.lft AND parent.rgt WHERE parent.extension = 'com_content' AND parent.published != 1 GROUP BY cat.id ) AS badcats ON badcats.id = c.id
WHERE a.access IN (1,1) AND c.access IN (1,1) AND CASE WHEN badcats.id is null THEN a.state ELSE 0 END = 1 AND a.featured = 0 AND a.catid IN (181,89,173,174,49,128,124,175,129,133,121,176,135,180,177,178,179,90) AND (a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2013-11-26 12:04:24') AND (a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2013-11-26 12:04:24')
GROUP BY a.id, a.title, a.alias, a.title_alias, a.introtext, a.checked_out, a.checked_out_time, a.catid, a.created, a.created_by, a.created_by_alias, a.created, a.modified, a.modified_by, uam.name, a.publish_up, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, a.hits, a.xreference, a.featured, a.fulltext, a.state, a.publish_down, badcats.id, c.title, c.path, c.access, c.alias, uam.id, ua.name, ua.email, contact.id, parent.title, parent.id, parent.path, parent.alias, v.rating_sum, v.rating_count, c.published, c.lft, a.ordering, parent.lft, fp.ordering, c.id, a.images, a.urls
ORDER BY a.created DESC LIMIT 0, 12;
What can I do to speed it up? Would indexing some of these tables help?
Thank you.
Absolutely indexes help in queries. And each of what I consider your secondary lookup reference tables (categories, users, content rating, etc) should have an index at a MINIMUM on what your join condition is between the tables.
table index on
j25_content ( access, featured, catid, publish_up, publish_down, state, id, created_by, modified_by )
j25_content_frontpage ( content_id )
j25_categories ( id, parent_id )
ANOTHER index...
j25_categories ( extension, published, lft, rgt, id )
j25_users ( id )
j25_contact_details ( published, user_id, language, id )
j25_content_rating ( content_id )
I've set these indexes up to be "covering" indexes... meaning they should help the optimization of the query by having all the fields as part of the index so it does not have to go to the raw data pages to see if all the pieces qualify to return a record
TRY that first...
NEXT thing I would try is MySQL has a special keyword "STRAIGHT_JOIN" which tells the
engine to run the query in the order you have stated. You seem to have a good basis
of the tables as the primary and your lookup as secondary. The engine might be trying
to think for you and use one of the smaller tables to run the query.
select STRAIGHT_JOIN (rest of your query exactly as it is)
I'm trying to optimize the following query. I'm thinking an outer join would do the trick, but I can't wrap my mind around how to put it together.
// ---------------------------------
// Simplified representation of data
// ---------------------------------
create table views (
user_id,
article_id
)
create table article_attributes (
article_id,
article_attribute_id
)
create table articles (
id,
title,
date
)
Views table has tens of millions of records.
Articles table has a couple hundred thousand.
I'm trying to match all articles with a certain attribute associated with it, and that have not been viewed by a user.
What I have tried, but doesn't scale well:
select a.title, a.sid as article_id, a.total_views as times_read, a.date
from articles a
join article_attributes att on att.article_id = a.sid
where a.sid not in(
select v.article_id
from views v
join article_attributes att on att.article_id = v.article_id
where user_id = 132385
and att.article_attribute_id = 10
group by v.article_id
)
and att.article_attribute_id = 10
and a.date >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 day)
order by total_views desc
limit 5
This works fine, but gets significantly slower the more articles the user has viewed. Any ideas or suggestions would be appreciated.
SELECT a.title, a.sid AS article_id, a.total_views AS times_read, a.date
FROM articles a
JOIN article_attributes att
ON a.id = att.article_id AND att.article_attribute_id = 10
LEFT JOIN views v
ON a.id = v.article_id AND v.user_id = 132385
WHERE v.user_id IS NULL
The first join gets you only the articles with the given attribute.
The second join takes the first join's result and returns rows with the user_id and all the remaining rows from first result that don't have the user_id.(Basically ALL articles with attribute 132385 with the user_id being either 10 or NULL)
Then all we want is that result where user_id is NULL
Try to avoid nested queries and let the engine do it's job. Note you can tag on your other filters (DATE, ORDER BY) on the end.
Try this query
select a.title, a.sid as article_id, a.total_views as times_read, a.date
from
articles a
left join
views v
on
a.sid = v.article_id AND v.article_id is null
join
article_attributes att
on
att.article_id = v.article_id AND v.user_id = 132385 AND att.article_attribute_id = 10
where
a.date >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 day)
order by
total_views desc limit 5
Create necessary index for articles table (total_views, sid, date)
view table (article_id, user_id)
article_attributes table (article_id, article_attribute_id)
Hope this helps.
Instead of using the subquery as a where condition, I suggest using it in a join. Also, I suggest you not to use group by in your subquery, but select distinct:
select
a.title, a.sid as article_id, a.total_views as times_read, a.date
from
(articles a
inner join article_attributes att on a.sid = att.article_id)
left join (
select distinct
v.article_id
from views v
inner join article_attributes att on v.article_id = att.article_id
where
user_id = 132385
and att.article_atribute_id = 10
) as b on a.sid = b.article_id
where
b.article_id is null
and att.article_attribute_id = 10
and a.date >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 day)
Hope this helps
EXISTS should work better than IN:
SELECT a.title,
a.sid AS article_id,
a.total_views AS times_read,
a.date
FROM articles a
JOIN article_attributes att ON att.article_id = a.sid
WHERE NOT EXISTS (SELECT 0
FROM views v
JOIN article_attributes att ON att.article_id = v.article_id
WHERE user_id = 132385
AND att.article_attribute_id = 10
AND v.article_id = a.sid )
AND att.article_attribute_id = 10
AND a.date >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY)
ORDER BY total_views DESC LIMIT 5
I'm working on the layered navigation module with Prestashop solution,
I'm trying to optimize a Sql query which create a tmp table to execute it and by this way create a bottleneck in mysql.
This is the query :
SELECT p.*, p.id_category_default, pl.available_later, pl.description_short, pl.link_rewrite, pl.name, i.id_image, il.legend, m.name manufacturer_name, DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL 30 DAY)) > 0 AS new
FROM `ps_category_product` cp
LEFT JOIN ps_category c ON (c.id_category = cp.id_category)
LEFT JOIN `ps_product` p ON p.`id_product` = cp.`id_product`
LEFT JOIN ps_product_lang pl ON (pl.id_product = p.id_product)
LEFT JOIN ps_image i ON (i.id_product = p.id_product AND i.cover = 1)
LEFT JOIN ps_image_lang il ON (i.id_image = il.id_image AND il.id_lang = 2)
LEFT JOIN ps_manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
WHERE p.`active` = 1 AND c.nleft >= 2 AND c.nright <= 29 AND c.active = 1 AND pl.id_lang = 2
AND p.id_product IN (74,78,130,146,168,169,178,195,...,297,302,1986,1987,1988,1993,1999,2000,2001)
GROUP BY p.id_product ORDER BY p.date_upd desc LIMIT 0,48
I know the tmp table is created because of the GROUP BY but I don't know how to remove it. If the same process could be done with PHP instead of SQL, it could be a solution.
Thanks in advance.
after updating my server php tp 5.3.3 the menu on joomla 1.5.6 doesn't work any more,
when I turned on the debug mode the below message appears
Profile Information
Application afterLoad: 0.005 seconds, 0.52 MB
Application afterInitialise: 0.877 seconds, 4.12 MB
Application afterRoute: 0.881 seconds, 4.45 MB
Application afterDispatch: 0.930 seconds, 6.21 MB
Application afterRender: 0.956 seconds, 6.64 MB
Memory Usage
7002564
10 queries logged
1. DELETE
FROM jos_session
WHERE ( time < '1329434797' )
2. SELECT *
FROM jos_session
WHERE session_id = 'vrklkcuiohl12g3la0lm4gp5v3'
3. UPDATE `jos_session`
SET `time`='1329435697',`userid`='0',`usertype`='',`username`='',`gid`='0',`guest`='1',`client_id`='0',`data`='__default|a:7:{s:15:\"session.counter\";i:3;s:19:\"session.timer.start\";i:1329434953;s:18:\"session.timer.last\";i:1329435238;s:17:\"session.timer.now\";i:1329435250;s:22:\"session.client.browser\";s:69:\"Mozilla/5.0 (Windows NT 6.1; rv:10.0.1) Gecko/20100101 Firefox/10.0.1\";s:8:\"registry\";O:9:\"JRegistry\":3:{s:17:\"_defaultNameSpace\";s:7:\"session\";s:9:\"_registry\";a:1:{s:7:\"session\";a:1:{s:4:\"data\";O:8:\"stdClass\":0:{}}}s:7:\"_errors\";a:0:{}}s:4:\"user\";O:5:\"JUser\":19:{s:2:\"id\";i:0;s:4:\"name\";N;s:8:\"username\";N;s:5:\"email\";N;s:8:\"password\";N;s:14:\"password_clear\";s:0:\"\";s:8:\"usertype\";N;s:5:\"block\";N;s:9:\"sendEmail\";i:0;s:3:\"gid\";i:0;s:12:\"registerDate\";N;s:13:\"lastvisitDate\";N;s:10:\"activation\";N;s:6:\"params\";N;s:3:\"aid\";i:0;s:5:\"guest\";i:1;s:7:\"_params\";O:10:\"JParameter\":7:{s:4:\"_raw\";s:0:\"\";s:4:\"_xml\";N;s:9:\"_elements\";a:0:{}s:12:\"_elementPath\";a:1:{i:0;s:63:\"/usr/www/users/mysite/libraries/joomla/html/parameter/element\";}s:17:\"_defaultNameSpace\";s:8:\"_default\";s:9:\"_registry\";a:1:{s:8:\"_default\";a:1:{s:4:\"data\";O:8:\"stdClass\":0:{}}}s:7:\"_errors\";a:0:{}}s:9:\"_errorMsg\";N;s:7:\"_errors\";a:0:{}}}'
WHERE session_id='vrklkcuiohl12g3la0lm4gp5v3'
4. SELECT *
FROM jos_components
WHERE parent = 0
5. SELECT folder AS type, element AS name, params
FROM jos_plugins
WHERE published >= 1
AND access <= 0
ORDER BY ordering
6. SELECT m.*, c.`option` AS component
FROM jos_menu AS m
LEFT JOIN jos_components AS c
ON m.componentid = c.id
WHERE m.published = 1
ORDER BY m.sublevel, m.parent, m.ordering
7. SELECT template
FROM jos_templates_menu
WHERE client_id = 0
AND (menuid = 0 OR menuid = 1)
ORDER BY menuid DESC
LIMIT 0, 1
8. SELECT a.id, a.title, a.title_alias, a.introtext, a.fulltext, a.sectionid, a.state, a.catid, a.created, a.created_by, a.created_by_alias, a.modified, a.modified_by, a.checked_out, a.checked_out_time, a.publish_up, a.publish_down, a.images, a.attribs, a.urls, a.metakey, a.metadesc, a.access, 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, CHAR_LENGTH( a.`fulltext` ) AS readmore, u.name AS author, u.usertype, g.name AS groups, cc.title AS category, s.title AS section, s.ordering AS s_ordering, cc.ordering AS cc_ordering, a.ordering AS a_ordering, f.ordering AS f_ordering
FROM jos_content AS a
INNER JOIN jos_content_frontpage AS f
ON f.content_id = a.id
LEFT JOIN jos_categories AS cc
ON cc.id = a.catid
LEFT JOIN jos_sections AS s
ON s.id = a.sectionid
LEFT JOIN jos_users AS u
ON u.id = a.created_by
LEFT JOIN jos_groups AS g
ON a.access = g.id
WHERE 1
AND a.access <= 0
AND a.state = 1
AND (( cc.published = 1
AND s.published = 1 ) OR ( a.catid = 0
AND a.sectionid = 0 ) )
AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2012-02-16 23:41:37' )
AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2012-02-16 23:41:37' )
ORDER BY f.ordering
LIMIT 0, 9
9. SELECT a.id, a.title, a.title_alias, a.introtext, a.fulltext, a.sectionid, a.state, a.catid, a.created, a.created_by, a.created_by_alias, a.modified, a.modified_by, a.checked_out, a.checked_out_time, a.publish_up, a.publish_down, a.images, a.attribs, a.urls, a.metakey, a.metadesc, a.access, 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, CHAR_LENGTH( a.`fulltext` ) AS readmore, u.name AS author, u.usertype, g.name AS groups, cc.title AS category, s.title AS section, s.ordering AS s_ordering, cc.ordering AS cc_ordering, a.ordering AS a_ordering, f.ordering AS f_ordering
FROM jos_content AS a
INNER JOIN jos_content_frontpage AS f
ON f.content_id = a.id
LEFT JOIN jos_categories AS cc
ON cc.id = a.catid
LEFT JOIN jos_sections AS s
ON s.id = a.sectionid
LEFT JOIN jos_users AS u
ON u.id = a.created_by
LEFT JOIN jos_groups AS g
ON a.access = g.id
WHERE 1
AND a.access <= 0
AND a.state = 1
AND (( cc.published = 1
AND s.published = 1 ) OR ( a.catid = 0
AND a.sectionid = 0 ) )
AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2012-02-16 23:41:37' )
AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2012-02-16 23:41:37' )
ORDER BY f.ordering
10. SELECT id, title, module, position, content, showtitle, control, params
FROM jos_modules AS m
LEFT JOIN jos_modules_menu AS mm
ON mm.moduleid = m.id
WHERE m.published = 1
AND m.access <= 0
AND m.client_id = 0
AND ( mm.menuid = 1 OR mm.menuid = 0 )
ORDER BY position, ordering
0 legacy queries logged
Language Files Loaded
• /usr/www/users/mysite/language/en-GB/en-GB.ini 1
• /usr/www/users/mysite/language/en-GB/en-GB.plg_system_debug.ini 1
• /usr/www/users/mysite/language/en-GB/en-GB.com_content.ini 1
• /usr/www/users/mysite/language/en-GB/en-GB.tpl_js_weblogic_brown.ini
• /usr/www/users/mysite/language/en-GB/en-GB.mod_breadcrumbs.ini 1
• /usr/www/users/mysite/language/en-GB/en-GB.mod_search.ini 1
• /usr/www/users/mysite/language/en-GB/en-GB.mod_mainmenu.ini 1
Untranslated Strings Diagnostic
None
Untranslated Strings Designer
None
PHP error as below
"17 Feb 2012 12:50:36","/usr/www/users/mysite/libraries/joomla/language/language.php: 336","(Warning) file_get_contents(/usr/www/users/mysite/language/en-GB/en-GB.tpl_js_weblogic_brown.ini): failed to open stream: No such file or directory"
"17 Feb 2012 12:50:36","/usr/www/users/mysite/libraries/joomla/language/language.php: 336","(Warning) file_get_contents(/usr/www/users/mysite/language/en-GB/en-GB.tpl_js_weblogic_brown.ini): failed to open stream: No such file or directory"
"17 Feb 2012 12:50:49","/usr/www/users/mysite/libraries/joomla/language/language.php: 336","(Warning) file_get_contents(/usr/www/users/mysite/language/en-GB/en-GB.tpl_js_weblogic_brown.ini): failed to open stream: No such file or directory"
"17 Feb 2012 12:50:49","/usr/www/users/mysite/libraries/joomla/language/language.php: 336","(Warning) file_get_contents(/usr/www/users/mysite/language/en-GB/en-GB.tpl_js_weblogic_brown.ini): failed to open stream: No such file or directory"
"17 Feb 2012 13:19:34","/usr/www/users/mysite/plugins/content/plugin_googlemap2.php: 432","(Deprecated) Assigning the return value of new by reference is deprecated"
"17 Feb 2012 13:30:52","/usr/www/users/mysite/plugins/content/plugin_googlemap2.php: 432","(Deprecated) Assigning the return value of new by reference is deprecated"
"17 Feb 2012 13:31:00","/usr/www/users/mysite/plugins/content/plugin_googlemap2.php: 432","(Deprecated) Assigning the return value of new by reference is deprecated"
Any body can help to solve this and make my menu work again?
Reinstall the template and the menu shall appear again.
And what about upgrading your Joomla to the latest version?
What are the menus which are not appearing?
front-end menus or back-end menus?
Also, have you tried to reinstall the admin menu too?
This problem is common when updating Joomla, and usually because the template menus are hardcoded.
-- Edit
Just noticed the error messages you posted below.
"17 Feb 2012 12:50:36","/usr/www/users/mysite/libraries/joomla/language/language.php: 336","(Warning) file_get_contents(/usr/www/users/mysite/language/en-GB/en-GB.tpl_js_weblogic_brown.ini): failed to open stream: No such file or directory"
This one indicates you have a missing language file (file name: en-GB.tpl_js_weblogic_brown.ini), related to the template (weblogic brown style). maybe this is the reason for disappeared menu.