Hi,

On Dec/16/2020, Muskan Vaswan wrote:

> Carles Pina I Estany: While I understand what you’re trying to do I
> don’t know why we are trying to avoid COUNT is there a best practice
> associated with this that I don’t know about?

We are (or... I was :-)   ) trying to answer this question as close as
to the database:
-"Are more than X number of rows?"

With COUNT we would answer:
-"How many rows are there?"

Depends on the model, indexes, data in the DB and database the COUNT
operation can take longer than the other way to know if there are more
than X rows. It needs proper checking.

It's more or less what's explained here:
https://docs.datasette.io/en/stable/sql_queries.html#pagination 
but I was thinking in terms of a Django ORM

Sorry if this was a detour on the higher level discussion. My message is
that it probably can be done without COUNT if need to be and show "more
than X rows" instead of the exact number of rows.

Cheers,

-- 
Carles Pina i Estany
https://carles.pina.cat

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/20201216084703.GA17389%40pina.cat.

Reply via email to