At 07:10 PM 1/23/2004, Larry Brown wrote:
I have a db that had some 20,000 records or so in it.  I have a query to
find out how many jobs have been input during the current day.  To add them
I ran the following query...

"select count(idnumber) from maintable where inputdatetime > '$date
00:00:00' and client='smith'"

$date is the current date in CCYY-MM-DD fashion and the query runs.  However
it seems fairly slow.  I have now added some 100,000+ records from a merge I
performed and now it takes a really long time.  Is there a better way to
query this that will take a load off the machine?  The only key in the table
is the idnumber.  I don't really know anything about how keys help or when
to/not to use them other than their being a necessity for an auto_increment
field.

TIA

Larry

Larry,
Add two indexes, one for InputDateTime and another for Client.
You should read up on MySQL. Try Paul Dubois book "MySQL 2nd Edition" because starts off really easy with stuff like this and by the time you're done, you're an expert.


Mike



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



Reply via email to