Skip to Content Skip to Menu

🕒 Save Time and Effort with CB Editor Assistant: Effortlessly create and refine content in Joomla 3, 4, & 5.
🎁 Limited Offer: Enjoy a 5-day FREE trial and save up to 30% afterward!

Connections tab long query

  • sfraise
  • sfraise
  • OFFLINE
  • Posts: 96
  • Thanks: 14
  • Karma: 4
12 years 2 months ago - 12 years 2 months ago #214353 by sfraise
Connections tab long query was created by sfraise
I just wanted to mention I've been noticing a long query crashing mysql lately on our site stemming out of the connections tab. The query I'm getting is...

SELECT a.referenceid, a.memberid AS d1, b.memberid AS d2, c.memberid AS d3, d.memberid AS d4, e.memberid AS d5, f.memberid AS d6
FROM `jos_comprofiler_members` AS a FORCE INDEX (aprm)
LEFT JOIN jos_comprofiler_members AS b FORCE INDEX (aprm) ON a.memberid=b.referenceid AND b.accepted=1 AND b.pending=0
LEFT JOIN jos_comprofiler_members AS c FORCE INDEX (aprm) ON b.memberid=c.referenceid AND c.accepted=1 AND c.pending=0
LEFT JOIN jos_comprofiler_members AS d FORCE INDEX (pamr) ON c.memberid=d.referenceid AND d.accepted=1 AND d.pending=0
LEFT JOIN jos_comprofiler_members AS e FORCE INDEX (pamr) ON d.memberid=e.referenceid AND e.accepted=1 AND e.pending=0
LEFT JOIN jos_comprofiler_members AS f FORCE INDEX (pamr) ON e.memberid=f.referenceid AND f.accepted=1 AND f.pending=0
WHERE a.referenceid = 1365 AND a.accepted=1 AND a.pending=0 AND f.memberid = 1365
AND b.memberid NOT IN ( 1365,a.memberid)
AND c.memberid NOT IN ( 1365,a.memberid,b.memberid)
AND d.memberid NOT IN ( 1365,a.memberid,b.memberid,c.memberid)
AND e.memberid NOT IN ( 1365,a.memberid,b.memberid,c.memberid,d.memberid)
AND f.memberid NOT IN ( 1365,a.memberid,b.memberid,c.memberid,d.memberid,e.memberid) LIMIT 0, 1

I'm running an older version of cb 1.2.3 on Joomla 1.5 so maybe this has been addressed in the newer versions.

I'm guessing at first glance that the NOT IN part of the query is what's killing the performance, plus there's a lot of joins that I don't know are really needed here. I'm going to replace it with my own plugin so I can rewrite the queries from scratch and implement an ajax pagination instead of using the standard old pagination this uses so it's not a big deal, just thought I'd share what I see in case it's useful to others. I doubt this is much of an issue for small membership sites but in this case we have a couple thousand members (which is still pretty small) but we have a couple of admin accounts that automatically get connected to all members when they join which means those accounts have a couple thousand friends.
Last edit: 12 years 2 months ago by sfraise.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48708
  • Thanks: 8319
  • Karma: 1447
12 years 2 months ago #214359 by krileon
Replied by krileon on topic Re: Connections tab long query

I'm running an older version of cb 1.2.3

That'd be the problem. The connection plugin has long since been optimized. With CB 1.9 it'll do about 4, but they're fully indexed so are very fast.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum