Jump to content

Mysql Alias Affects Query Speed


Recommended Posts

In trying to optimize SQL queries as much as possible I made an interesting discovery.

 

SELECT p.* FROM `ps_product` p ... took on my setup 38.5sec!

SELECT pppppp.* FROM `ps_product` pppppp ... took on my setup ~3sec.

 

Default prefix is ps_ when setting up a new Prestashop platform. I was just informed by current hosting provider that since prefix starts with 'p' and your alias is 'p' then MySQL has to run through all ~250 tables before its locating ps_product before it can present back data requested.

 

Can someone confirm this? If this is the case shouldn't default prefix during installation be recommended to something else not starting with p since the whole codebase utilizes alias 'p' in all queries referring to ps_product?

 

Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...