Hello,
Currently I am using sysklogd-sql to store syslog messages in a MySQL
4.0.24. The current number of rows is around 3,799,700.
The table layout is as follows:
ID
machine
facility
priority
date1
message
Now ID is the primary key and it had one index called hostname
containing (machine).
I do a lot of queries based off information on the machine name and
date1 field. So I created the following index:
`CREATE INDEX hostdate ON syslog (machine,date1);`
This index has a "Cardinality" of 1,899,353 - this number is about half
of the total number of entries.
When I run the following:
`Select DISTINCT machine from syslog WHERE date1 > (NOW() - INTERVAL 1
hour);' it takes 9min to complete.
If I use "Explain" it says the query is using index "hostname", should
it not be using the index "hostdate" which contains fields "machine" and
"date1" since those are the fields I am using in my query ?
Thanks.
Michael
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]