last day (14 days later) » 

1:10 PM
0
Q: Optimize MySQL for Prestashop 1.6

torayeffI am running Prestashop 1.6 powered e-shop on VPS with 4GB RAM, 2CPUs, 60GB SSD characteristics. Currently I have about 20000 products in my shop and I am having problems with site loading because mysql queries run long. And when I run htop to analyze processes, I see that mysql consumes 100% of ...

 
So basically you're seeking professional tuning help for free, plus you don't know where to start optimizing?
 
@DRapp here is the output of slow query log pastie.org/9664946
@N.B. If I knew I would not have asked. Be it professional tuning or not I have a right to learn.
 
Of course you have the right to learn, I would never question that. However, you posted output of a program and then what, you expect spoon feeding? For example, the program tells you this: Enable the slow query log to troubleshoot bad queries. Google > "Enable the slow query log to troubleshoot bad queries" > if in trouble - ask here. This way, it appears like you want everything done for you, because the question you asked is without sufficient info to help you. It looks like you want a complete solution instead of clues on where to approach the problem.
 
@N.B. OK I do not want to argue. If you can help.
 
Start by enabling slow query log. It will log queries that take too much time to complete. Once you have several of those, and if they are SELECT type - add EXPLAIN before SELECT to see the execution plan. You do this from MySQL terminal or PHPMyAdmin (or any other MySQL GUI). It will tell you what MySQL is trying to do internally to execute the query. Once you have that, post the queries along with table structure here for further analysis.
 
1:10 PM
@N.B This query which I pasted here pastie.org/9665033 takes about 12 seconds to execute only to display 8 records.
Can I somehow cache queries?
 
The query itself is not useful alone. We need to see execution plan. Add EXPLAIN before select like this: EXPLAIN SELECT and post that back.
 
Can we chat here?
 
Hello, of course. Can you add the EXPLAIN to the query? If you post execution plan back and edit your question, there will be MySQL experts that will follow up with a good advice on how to optimize it. The query you've done is not exactly trivial, it's hard to guess which step is a tricky one
 
I run explain select
 
1:46 PM
here is explain select output pastie.org/9665152
 
2:00 PM
Are you using InnoDB engine?
If yes, what does SHOW VARIABLES LIKE '%buffer_pool%'; show?
Your query is such that it can't be optimized in the sense of inspecting low amount of rows.
MySQL has to go through 19k records. But, 19k records is nothing really. It should be able to do so instantly. Therefore, you need to let MySQL use your hardware accordingly. By default, MYSQL is tuned to work really, really slow
 
 
1 hour later…
3:14 PM
Not I am using MyISAM
But anyway thanks for you help
 
You have an SSD-based server. You shouldn't use MyISAM but InnoDB. Since it's an online web shop and deals with OLTP, it's crazy to use MyISAM. If anything, you should uninstall MyISAM engine and forget it ever exists.
 

last day (14 days later) »