Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 3bb2486

Browse files
committed
change optimized pgsql tables/rows query
1 parent 3fd70cb commit 3bb2486

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ServiceStack.OrmLite.PostgreSQL/PostgreSQLDialectProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ public override string ToTableNamesWithRowCountsStatement(bool live, string sche
386386
{
387387
return live
388388
? null
389-
: "SELECT relname, n_live_tup FROM pg_stat_user_tables WHERE schemaname = {0}".SqlFmt(this, schema ?? "public");
389+
: "SELECT relname, reltuples FROM pg_class JOIN pg_catalog.pg_namespace n ON n.oid = pg_class.relnamespace WHERE nspname = {0}".SqlFmt(this, schema ?? "public");
390390
}
391391

392392
public override bool DoesTableExist(IDbCommand dbCmd, string tableName, string schema = null)

0 commit comments

Comments
 (0)