Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions src/tools/performance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export async function getTableStatsTool(
SELECT
schemaname as schema_name,
relname as table_name,
(COALESCE(n_tup_ins, 0) + COALESCE(n_tup_upd, 0) + COALESCE(n_tup_del, 0))::bigint as row_count,
COALESCE(n_live_tup, 0)::bigint as row_count,
pg_relation_size(schemaname||'.'||relname) as table_size_bytes,
pg_size_pretty(pg_relation_size(schemaname||'.'||relname)) as table_size_pretty,
pg_indexes_size(schemaname||'.'||relname) as index_size_bytes,
Expand All @@ -129,7 +129,7 @@ export async function getTableStatsTool(
SELECT
schemaname as schema_name,
relname as table_name,
(COALESCE(n_tup_ins, 0) + COALESCE(n_tup_upd, 0) + COALESCE(n_tup_del, 0))::bigint as row_count,
COALESCE(n_live_tup, 0)::bigint as row_count,
pg_relation_size(schemaname||'.'||relname) as table_size_bytes,
pg_size_pretty(pg_relation_size(schemaname||'.'||relname)) as table_size_pretty,
pg_indexes_size(schemaname||'.'||relname) as index_size_bytes,
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/container.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ describe("Testcontainer Integration Tests", () => {
(s) => s.table_name === "users"
);
expect(userStats).toBeDefined();
expect(userStats!.row_count).toBeGreaterThanOrEqual(0);
expect(userStats!.row_count).toBe(3);
expect(userStats!.table_size_bytes).toBeGreaterThan(0);

// Test 12: Get table stats for specific table
Expand All @@ -304,6 +304,7 @@ describe("Testcontainer Integration Tests", () => {
expect(userStatsResult.stats).toBeDefined();
expect(userStatsResult.stats!.length).toBe(1);
expect(userStatsResult.stats![0].table_name).toBe("users");
expect(userStatsResult.stats![0].row_count).toBe(3);

// Test 13: List views
const viewsResult = await listViewsTool({ schema: "testschema" });
Expand Down