Sebastian wrote:

i forgot to add another question,

is it ok to add index after the tables and data are already built, or is it better to create the index before data gets inserted?

It's probably better to create the indexes up front (assuming you know in advance which ones will be needed), but I think that's a moot point if your table already exists and is full of data. There's no sense starting from scratch when you can simply add the index with

  ALTER TABLE yourtablename ADD INDEX name (item, type);

Be aware, however, that mysql alters a table by making a new, temporary table to match the new definition (old def + alterations), fills it with data from the original table, then replaces the old with the new. The time to do this grows with the size of your table and number of indexes. While it is in progress, statements which would change the data (e.g. INSERT, UPDATE) are locked out. See the manual for details <http://dev.mysql.com/doc/mysql/en/alter-table.html>.

Michael


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to