Skip to content

Commit 0823a02

Browse files
authored
fix: Inaccurate table total row count for PostgreSQL (#8511)
1 parent 5eb690c commit 0823a02

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/Adapters/Storage/Postgres/PostgresStorageAdapter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2040,7 +2040,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
20402040
if (where.pattern.length > 0 || !estimate) {
20412041
qs = `SELECT count(*) FROM $1:name ${wherePattern}`;
20422042
} else {
2043-
qs = 'SELECT reltuples AS approximate_row_count FROM pg_class WHERE relname = $1';
2043+
qs = 'SELECT n_live_tup AS approximate_row_count FROM pg_stat_all_tables WHERE relname = $1;';
20442044
}
20452045
20462046
return this._client

0 commit comments

Comments
 (0)