List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:September 24 1999 12:00am
Subject:RE: Long selects
View as plain text  
>>>>> "Steven" == Steven Roussey <sroussey@stripped> writes:

>> > select statements that take forever:
>> > SELECT count(*) FROM gas_alarms, gas_alarm_attributes WHERE
>> > gas_alarms.internal_id = gas_alarm_attributes.alarm_id AND
>> state = 'closed'
>> > AND
>> > timestamp >= FROM_UNIXTIME(938010283) AND timestamp <=
>> > FROM_UNIXTIME(938096683);
>> >
>> > Count took 45 seconds

Steven> I have experienced major speed delays when using count(*) in MySQL when the
Steven> MySQL is busy. You might try removing all count(*) statements with a select
Steven> on the smallest field and simply count the results. We found this changed
Steven> our server from almost crippled to very usable.

Hi!

The above shouldn't be true;  COUNT(*) without a group by should
always be much faster than counting rows.

Any change you can modify one of the MySQL benchmarks (test-insert?)
to verify the above?

Regards,
Monty

Thread
Long selectsmikep23 Sep
  • Re: Long selectssasha23 Sep
    • RE: Long selectsSteven Roussey24 Sep
      • RE: Long selectsMichael Widenius24 Sep
RE: Long selectsmikep23 Sep
  • RE: Long selectsMichael Widenius24 Sep