-
With a big database loading the list page is very slow, and can time out. This seems to be caused by the fact that sqladmin is running count query when loading the list page, which basically queries the entire db. Line 770 in fadf4d6 Has anybody else run into this issue and found a solution/workaround to make this faster? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Could you please provide me with the count of a specific table? |
Beta Was this translation helpful? Give feedback.
-
I’m also interested to know how big is your data and how have you confirmed this is the slow query. |
Beta Was this translation helpful? Give feedback.
-
After reading this article: https://www.citusdata.com/blog/2016/10/12/count-performance/#:~:text=copy-,Estimated%20Counts,-Full%20Table%20Estimates def count_query(self, request: Request) -> Select:
query = '''\
SELECT
COALESCE(reltuples / NULLIF(relpages,0), reltuples) * (
pg_relation_size(:tablename) /
(current_setting('block_size')::integer)
)
FROM pg_class where relname = :tablename;'''
return text(query).params(tablename=self.model.__tablename__)
Pros:
Cons:
|
Beta Was this translation helpful? Give feedback.
After reading this article: https://www.citusdata.com/blog/2016/10/12/count-performance/#:~:text=copy-,Estimated%20Counts,-Full%20Table%20Estimates
I ended up overriding the
count_query
with the following code:…