I've noticed some of my queries take too long. Can I just add indexes to my databases? Does anyone know of any negative consequences of that? The particular issue I'm having is a CCK node reference field type. It sorts through the entire table rather than just plucking out the node reference I'm after.

Thanks in advance for help and/or comments.

Missy

Comments

ceejayoz’s picture

The only negative consequence is going to be that indexes use up a bit of disk space.

I've found that some Drupal modules don't add good indexes. Add, experiment, and then file an issue with the module maintainers if you find a useful index.

As If’s picture

That's true, many modules are rather careless about their use of the DB. In general, you want to have an index for everything you see in a WHERE clause - that's especially true for slow queries and very frequent queries. Start with the worst offenders; you can find them using the Devel module.

-------------------------------------------
Interactive Worlds and Immersive Obsessions
http://www.asifproductions.com