maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #03863
Re: Optimization about count(*) of mysql 5.1.38
Hi, Sergei!
2011/1/24 Sergei Golubchik <serg@xxxxxxxxxxxx>:
> Hi, Lichao!
>
> On Jan 24, Lichao Xie wrote:
>> Hi, Sergei!
>> I'm sorry, my English is not so good!
>> There is no a API to get the exact records in a range, but the API can
>> help to improve performance for the case: select count(*) from t where
>> id > 10 and id < 1000000;
>> I want to know why there is no such a API.
>
> Because we did not need it so far - no engine had it.
>
> And because the set of queries that it can optimize is pretty small, so
> it most cases this feature is not worth implementing.
Well. However, we had encountered this problem. The application
submits a lot of queries like this case. Then the mysql server and
storage engine's loads had been very high. Although, we have used
cache to reduce the number of this query, the result have been not
very good. So, we have modified sql/opt_sum.cc to get the exact
records in a range. Of course, it has effects only on our storage
engine. Present seemed to work well.
>
> Regards,
> Sergei
>
References