News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

userinfos table key

Started by seyi, November 21, 2014, 13:22:21 PM

Previous topic - Next topic

seyi

Hi Guys,

I have a query where I am left joining #__virtuemart_userinfos table, like this:

             LEFT JOIN #__virtuemart_userinfos uv ON uv.virtuemart_user_id=uu.user_id AND uv.address_type="BT"

It works fine when there is not that many records, but as it gets larger it gets much slower.

To give an example, on a very powerful server (24 cores) with a lot of memory (24 GB RAM) and fast drives (SSD), where there is over 30,000 users, the query slows down and takes over 4 minutes to run.

After some debugging by Percona, they found that adding this key fixes the problem:

             ALTER TABLE `#__virtuemart_userinfos` ADD KEY(`virtuemart_user_id`,`address_type`);

Now it takes 0.24 seconds to run the same query.

Possible to add the key to core?
Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - http://www.awocoupon.com/starter
   - AwoCoupon Pro - http://awodev.com/products/joomla/awocoupon
   - AwoRewards - http://awodev.com/products/joomla/aworewards
   - AwoAffiliate - http://awodev.com/products/joomla/awoaffiliate

AH

Regards
A

Joomla 3.10.11
php 8.0

seyi

Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - http://www.awocoupon.com/starter
   - AwoCoupon Pro - http://awodev.com/products/joomla/awocoupon
   - AwoRewards - http://awodev.com/products/joomla/aworewards
   - AwoAffiliate - http://awodev.com/products/joomla/awoaffiliate

Milbo

How works that?

PRIMARY KEY (`virtuemart_userinfo_id`),
  KEY `i_virtuemart_user_id` (`virtuemart_userinfo_id`,`virtuemart_user_id`),
  KEY `virtuemart_user_id` (`virtuemart_user_id`,`address_type`),
  KEY `address_type` (`address_type`),
  KEY `address_type_name` (`address_type_name`)

??
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

seyi

Hi Milbo,

Yes, that works well on testing.
Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - http://www.awocoupon.com/starter
   - AwoCoupon Pro - http://awodev.com/products/joomla/awocoupon
   - AwoRewards - http://awodev.com/products/joomla/aworewards
   - AwoAffiliate - http://awodev.com/products/joomla/awoaffiliate