New db index added by plugin on core tables

Creating and modifying plugins.
Post Reply
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

New db index added by plugin on core tables

Post by blog.brockha.us »

I would like to count comments by a single commenter in my blog. For that I would count comment emails. I will need an index to do that in a performant way.

What do you think? Is it okay, if plugins add indexes to core tables? And if yes, should they remove the index on uninstall?

Thanks for input. :)
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: New db index added by plugin on core tables

Post by garvinhicking »

Hi!

I wouldn't mind a plugin doing that, this won't really hurt. I wouldn't remove the index after uninstalling because of the same reasoning.

The only thing the plugin could IMHO check (using the given SQL syntax, since mysql and pgsql and sqlite AFAIK differ for this) is if the index already exists, so that it doesn't get added multiple times.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Re: New db index added by plugin on core tables

Post by blog.brockha.us »

Okay. Thanks for the input, Garvin.:)

About removing the index: I was a little worried about unnecessary performance slow down while inserting. On the other hand: If another plugin relies on the same index, it would be nasty to remove it while uninstalling.

(Are you back? And already in this forum again? You are my Jungle King :mrgreen:)
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/
Post Reply