-1

select count(*) from bill limit 100000;

mysql> select count(*) from `bill` limit 100000; +----------+ | count(*) | +----------+ | 47497305 | +----------+ 1 row in set

Zeyu
  • 55
  • 10

1 Answers1

3

limit limits the number of rows outputted in the result set, not the number of rows that are processed.

Therefore it doesn't have any impact on queries like count(*) .

To achieve this you would have to wrap query into another sub select. Although such query doesn't make too much sense:

SELECT COUNT(*) FROM (
    SELECT * FROM bill LIMIT 100000
) t
Zbynek Vyskovsky - kvr000
  • 18,186
  • 3
  • 35
  • 43