New keys and indexes

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
Piratos

New keys and indexes

Post by Piratos »

You should make a new set of keys in your cms to make it clean and faster.
Now the sets are not the best and with wrong performance.

I have tested this with the best result:

  Table content
  PRIMARY KEY  (`content_id`),
  KEY `content_alias` (`content_alias`),
  KEY `hierarchy` (`hierarchy`),
  KEY `owner_id` (`owner_id`)

  Table  module_news_categories
  PRIMARY KEY  (`news_category_id`),
  KEY `hierarchy` (`hierarchy`)

  Table modules
  PRIMARY KEY  (`module_name`)
 
  Table adminlog
  PRIMARY KEY  (`timestamp`)

  Table htmlblobs
  PRIMARY KEY  (`htmlblob_id`),
  KEY `htmlblob_name` (`htmlblob_name`)
 
  Table users
  PRIMARY KEY  (`user_id`),
  KEY `username` (`username`)

  Table module_deps
  PRIMARY KEY  (`parent_module`)
 
  ----------------------------------------------------------------
  In your initial.sql are some inserts ('headtags') with duplicated keys in table content_props
Doug

Re: New keys and indexes

Post by Doug »

Interesting...

Has anyone else verified this?  What do the developers think?
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm
Location: Fairless Hills, Pa USA

Re: New keys and indexes

Post by Ted »

Sorry, I've been out of town.  I totally agree that this should be done and I'll get it into svn as soon as I can.  Going to verify it all, of course, but at a quick glance it looks correct to me.

Nice job
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: New keys and indexes

Post by calguy1000 »

For everybody's information, we've decided to go through and do a general review of keys and indexes in the cmsms core.

We'll start with pyratos' ideas here, and also draw up a list of the most commonly used queries in cmsms, and from that we'll modify the schema to set whatever keys, and create whatever indexes are necesssary.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Trekkie101

Re: New keys and indexes

Post by Trekkie101 »

Quick note to anyone working with keys ever

Primary keys should be created on unqiue fields only, and only make things a key if its a foreign key in another table, otherwise dont make it a key.

Unless its supposed to be a compound key to support something else but in general try and use a little keys as possible
Last edited by Trekkie101 on Wed Jan 25, 2006 5:44 pm, edited 1 time in total.
Post Reply

Return to “Developers Discussion”