fix: Inaccurate table total row count for PostgreSQL (#8511)
This commit is contained in:
@@ -2040,7 +2040,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
|||||||
if (where.pattern.length > 0 || !estimate) {
|
if (where.pattern.length > 0 || !estimate) {
|
||||||
qs = `SELECT count(*) FROM $1:name ${wherePattern}`;
|
qs = `SELECT count(*) FROM $1:name ${wherePattern}`;
|
||||||
} else {
|
} else {
|
||||||
qs = 'SELECT reltuples AS approximate_row_count FROM pg_class WHERE relname = $1';
|
qs = 'SELECT n_live_tup AS approximate_row_count FROM pg_stat_all_tables WHERE relname = $1;';
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._client
|
return this._client
|
||||||
|
|||||||
Reference in New Issue
Block a user