Skip to Content Skip to Menu

Adding index on comprofiler-related tables for performance

  • lylejover
  • lylejover
  • OFFLINE
  • Posts: 30
  • Thanks: 3
  • Karma: 1
10 years 5 months ago #245214 by lylejover
Hi,

I would assume that the building of SQL queries to populate userlists is already optimized, correct? So I was thinking of adding indexes on different cbfields to improve the performance of userlists. Basically, we are encountering a spike on CPU (we are at 3 cores already) whenever users are trying to access the userlists. Is it safe to add specific indices on the CB fields? If yes, what are your suggestions?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
10 years 5 months ago #245227 by krileon
You can safely add indexes to any of CBs database tables as needed. This is actually very recommended for popular sites to ensure your queries are optimized to your usage. We've implemented optimized generic indexes, but we can't get any more specific with them as custom fields come into the picture.


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.

  • lylejover
  • lylejover
  • OFFLINE
  • Posts: 30
  • Thanks: 3
  • Karma: 1
10 years 5 months ago #245261 by lylejover
Hi krileon,

Thank you for the kind reply.

I'm looking to add a lot of FULLTEXT indexes on the CB fields that have free text on them. If I add them via let's say, PHPMyAdmin, is that all I need to get the index working?

Also, I noticed that a lot of the custom fields have "Spatial" index by default. Do you think this is ok? Or should I switch indexes depending on the data that would be contained on that column?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
10 years 5 months ago #245275 by krileon

lylejover wrote: If I add them via let's say, PHPMyAdmin, is that all I need to get the index working?

Yes.

lylejover wrote: Also, I noticed that a lot of the custom fields have "Spatial" index by default. Do you think this is ok? Or should I switch indexes depending on the data that would be contained on that column?

It depends on what queries you use most, but yes it's ok. You can remove/change indexes as needed, but I recommend making a backup of your database before doing so just to be safe.


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.

  • lylejover
  • lylejover
  • OFFLINE
  • Posts: 30
  • Thanks: 3
  • Karma: 1
10 years 5 months ago #245415 by lylejover
Thanks, krileon!

One last question: If we have a CB field that is a dropdown list (example: Location), can the data type for that column be changed to ENUM without losing data integrity/userlist output?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
10 years 5 months ago #245424 by krileon
I don't recommend changing a columns type. You're welcome to try, but I've no idea if that'll work right or not. Be sure to create a backup of your database before doing it though.


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