I could be wrong but I seem to remember that Primary keys are indexed automatically. 
Regardless, smallints and dates really are pretty easy to index. So go for it! Strings 
introduce a bit of overhead, but I've never heard anyone, nor would I, recommend 
holding back on indexing because you have too many. Remember, the server only uses the 
index when it can, or when you explicitly tell it to. Sometimes it will try to use an 
index and it shouldn't, but there's never really a reason not to use it on numeric 
fields, which all of yours really are (dates are numeric on the insides).

<>< Ryan 

-----Original Message-----
From: Steve Bradwell [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 03, 2002 9:24 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] indexing


Hi all,

More of a database question here, my apologies:

I've been doing some reading on indexes but I thought I should get an
experienced persons input. My question is about "Over Indexing".
I have a MySQL MyISAM table that stores inventory transactions, in, out
etc. I store numeric fields that are primary indexes in other tables, 2
datetime fields and a qty field, Paul DuBois' MySQL book says that
anything used in a where clause or join clause is a candidate for an
index. It turns out that 7 out of eight fields fit this description,1
primary key, 4 smallints, and 2 are datetime fields. 
 
Should I use all these indexes or is this overkill?

Thanks for any input
Steve.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to