If the order of your columns in the index is what you say ( Vessel + Voyage
+ Port ), MySQL will use the index if you specify the Vessel and Voyage
values.
The index could not be used if you didn't use the first column of the index
(for example, specifying values for Voyage and Port columns)...

Patrick

-----Message d'origine-----
De : Don [mailto:[EMAIL PROTECTED]]
Envoyé : mercredi 24 janvier 2001 15:45
À : msql list
Objet : Index question


Say I have a table called Discharge that is indexed on Vessel + Voyage +
Port (Primary Key).  It has thousands of records in it and continuously
grows.  I now want to delete records where

Vessel = "USS ENTERPRISE"
Voyage = "005"

I want to delete all records with the above Vessel/Voyage.  There can be
anywhere from 1 to 20 records with that match (different Port).

My SQL statement is:

DELETE FROM Discharge where Vessel = "USS ENTERPRISE"
                                              AND Voyage = "005";

My question is one pertaining to performance.  Will MySQL scan through
the entire table or will it utilize the index and quickly delete all
record with the above statement?

If the former, what would be an efficient and quick way to delete
records of a partial key?

Thanks,
Don


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to