Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make collStats calculate collection size accurately for PostgreSQL statistics #3513

Merged
merged 8 commits into from
Oct 11, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
merge conflict
  • Loading branch information
chilagrow committed Oct 10, 2023
commit 32a50ee0aa1248a98e2081727f90eaab3ddbd64a
4 changes: 0 additions & 4 deletions internal/backends/postgresql/postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@
args = append(args, c.TableName)
}

// get index count from metadata
// TODO https://github.com/FerretDB/FerretDB/issues/3394
s.countIndexes = 0

// The table size is the size used by collection objects. It excludes visibility map,
// initialization fork, free space map and TOAST. The `main` `pg_relation_size` is
// used, however it is not updated immediately after operation such as DELETE
Expand All @@ -87,7 +83,7 @@
q = fmt.Sprintf(`
SELECT
COALESCE(SUM(c.reltuples), 0),
COALESCE(SUM(pg_relation_size(c.oid,'main')), 0),

Check warning on line 86 in internal/backends/postgresql/postgresql.go

View check run for this annotation

Codecov / codecov/patch

internal/backends/postgresql/postgresql.go#L86

Added line #L86 was not covered by tests
COALESCE(SUM(pg_indexes_size(c.oid)), 0)
FROM pg_tables AS t
LEFT JOIN pg_class AS c ON c.relname = t.tablename AND c.relnamespace = quote_ident(t.schemaname)::regnamespace
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.