Here's how I do it with tables that have multiple keys:

CREATE TABLE Users
(
        Id SMALLINT UNSIGNED UNIQUE NOT NULL AUTO_INCREMENT,
        FirstName VARCHAR(25) NOT NULL,
        LastName VARCHAR(25) NOT NULL,


        PRIMARY KEY(Id),
        KEY LastNameIndex (LastName),
        Key FirstNameIndex (FirstName)
) ;

And every once in a while I also do an "optimize table <tablename>" when my
queries are getting slower.  The only thing you have to watch out for with
the optimize command is that it can take a while if you have a large table
and that table will become unavailable for access while the command is
running.

-Pete

-----Original Message-----
From: Scott Fletcher [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 05, 2004 11:01
To: [EMAIL PROTECTED]
Subject: Using the Index (Tables)....

I have one question.  Once I create 2 or more indexes to a table, should I
instruct MySQL to use which index in certain order?  (Like use that 2nd
index, not the 1st one).  Another question, do I need to run the maintance
on the index?  If so, how?  With IBM DB2, I had to run the index maintance
weekly, so I wonder if MySQL do it automatically or do I have to do it
manually.  If so, how?

 

Thanks,

 FletchSOD





***********************************************************************************

This message and any files transmitted with it are confidential and intended solely 
for the use of the individual or entity to whom it is addressed. It may contain 
sensitive and private proprietary or legally privileged information. No 
confidentiality or privilege is waived or lost by any mistransmission. If you are not 
the intended recipient, please immediately delete it and all copies of it from your 
system, destroy any hard copies of it and notify the sender. You must not, directly or 
indirectly, use, disclose, distribute, print, or copy any part of this message if you 
are not the intended recipient. Tradition Asiel Securities Inc. and Tradition (North 
America) Inc. reserve the right to monitor all e-mail communications through its 
networks. Any views expressed in this message are those of the individual sender, 
except where the message states otherwise and the sender is authorized to state them.

Unless otherwise stated, any pricing information given in this message is indicative 
only, is subject to change and does not constitute an offer to deal at any price 
quoted. Any reference to the terms of executed transactions should be treated as 
preliminary only and subject to our formal written confirmation. Tradition Asiel 
Securities Inc. and Tradition (North America) Inc. are not responsible for any 
recommendation, solicitation, offer or agreement or any information about any 
transaction, customer account or account activity contained in this communication.

This footnote also confirms that this email message has been swept by
Anti-virus detection software for the presence of computer viruses.

***********************************************************************************



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

Reply via email to