Answer the question
In order to leave comments, you need to log in
Is it possible to use COUNT(*) along with Limit?
I need to check if there are more files in the database than 1000.
COUNT(*) is not suitable for me. takes too long, is there any quick way to just know if there are enough files to process or not? Thus without scanning all table.
Answer the question
In order to leave comments, you need to log in
try like this
select count(*) from
(select * from some_table limit 1000) a
Get an index in the table and count, for example, count(id).
Another option is to have triggers for insertion and deletion so that they change the corresponding counter. But here it is necessary to carefully organize transactions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question