• Home
  • Get help
  • Ask a question
Last post 8 hours 11 min ago
Posts last week 141
Average response time last week 4 hours 42 min
All time posts 67824
All time tickets 10480
All time avg. posts per day 21

Helpdesk is open from Monday through Friday CET

Please create an (free) account to post any question in the support area.
Please check the development versions area. Look at the changelog, maybe your specific problem has been resolved already!
All tickets are private and they cannot be viewed by anyone. We have made public only a few tickets that we found helpful, after removing private information from them.

#3147 – Slow Update Query

Posted in ‘sh404SEF’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Wednesday, 11 January 2017 04:03 UTC
dwt100
 
Hi,

Update queries are taking time 40-70 ms when view in debug mode. Examples queries are

UPDATE `jos_sh404sef_urls`
SET `cpt`=16044, `last_hit`='2017-01-11 03:54:28'
WHERE `id`='1025'
AND `rank`=0;


Question here is that is there any particular reason to enclose id value in quotes i.e. `id`='1025' when id column is int not string? Will not comparing int with string
sql query will make it slow?


Kind regards,

Azeem
Wednesday, 11 January 2017 08:58 UTC
wb_weeblr
Hi

I don't see how this would make any measurable difference. Have a look at the EXPLAIN section, and you'll see the query is fully indexed and optimized by MySQL:



1 - What are your full and exact Joomla and sh404SEF versions?
2 - Is this on a real life server or on localhost machine? (on my local test machine, this queries uses 1.79ms)
3 - How does it compare to other write instructions happening on the same page?
4 - You can always try to make the var an int, I would suggest the following:

- Open /administrator/components/com_sh404sef/classes/router.php
- at line 1304, replace:
ShlDbHelper::update('#__sh404sef_urls', array('cpt' => $hits, 'last_hit' => ShlSystem_Date::getUTCNow()), array('id' => $lookUp->urlRecord->id, 'rank' => 0));

with
ShlDbHelper::update('#__sh404sef_urls', array('cpt' => $hits, 'last_hit' => ShlSystem_Date::getUTCNow()), array('id' => (int) $lookUp->urlRecord->id, 'rank' => 0));


As an alternative version, you can also use instead:
ShlDbHelper::update('#__sh404sef_urls', array('cpt' => $hits, 'last_hit' => ShlSystem_Date::getUTCNow()), array('id' => (int) $lookUp->urlRecord->id));


In all cases, I'd rather suggest you check and optimize your sh404sef_urls database table, it may be damaged or corrupted, or in need of optimization.

Rgds


 
Wednesday, 11 January 2017 21:41 UTC
dwt100
Hi,

Thanks for kind reply.

It was on local machine. It was one of two queries taking much time ( red bar ). Other one is by debug mode. I can not take risk to enable debug mode on production server.
I will check proposed changes just to see how it goes? But as per your advice, i will check table first. Can you please show me link / page to follow optimisation of sh404sef table?

sh404sef version: 4.8.2.3492
Joomla version: Joomla! 3.6.5 Stable


Kind regards,

Azeem

Thursday, 12 January 2017 08:48 UTC
wb_weeblr
Hi

Can you please show me link / page to follow optimisation of sh404sef table?
I was not talking about anything regarding sh404SEF, but simply MYSQL database table optimization, ie server maintenance. This can be achieved with PHPMYAdmin or similar, or maybe your hosting control panel, if your hosting company offers one. If not, then the best people to talk to are the hosting company indeed.

Rgds
 
Thursday, 12 January 2017 11:25 UTC
dwt100
Hi,

Thanks.


Kind regards,

Azeem
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.