Skip to content
Merged
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
16 changes: 16 additions & 0 deletions aqo--1.5--1.6.sql
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,19 @@ AS 'MODULE_PATHNAME', 'aqo_queries'
LANGUAGE C STRICT VOLATILE PARALLEL SAFE;

CREATE VIEW aqo_queries AS SELECT * FROM aqo_queries();

CREATE FUNCTION aqo_memory_usage(
OUT name text,
OUT allocated_size int,
OUT used_size int
)
RETURNS SETOF record
AS $$
SELECT name, total_bytes, used_bytes FROM pg_backend_memory_contexts
WHERE name LIKE 'AQO%'
UNION
SELECT name, allocated_size, size FROM pg_shmem_allocations
WHERE name LIKE 'AQO%';
$$ LANGUAGE SQL;
COMMENT ON FUNCTION aqo_memory_usage() IS
'Show allocated sizes and used sizes of aqo`s memory contexts and hash tables';
9 changes: 9 additions & 0 deletions t/001_pgbench.pl
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@
WHERE v.exec_time > 0.");
is($res, 3);

$res = $node->safe_psql('postgres', "SELECT * FROM aqo_memory_usage() AS t1");
note("MEMORY:\n$res\n");

# ##############################################################################
#
# pgbench on a database with AQO in 'learn' mode.
Expand All @@ -184,6 +187,9 @@
"$TRANSACTIONS", '-c', "$CLIENTS", '-j', "$THREADS" ],
'pgbench in frozen mode');

$res = $node->safe_psql('postgres', "SELECT * FROM aqo_memory_usage() AS t1");
note("MEMORY:\n$res\n");

# ##############################################################################
#
# Check procedure of ML-knowledge data cleaning.
Expand Down Expand Up @@ -299,6 +305,9 @@
is($new_stat_count == $stat_count - $pgb_stat_count, 1,
'Total number of samples in aqo_query_stat');

$res = $node->safe_psql('postgres', "SELECT * FROM aqo_memory_usage() AS t1");
note("MEMORY:\n$res\n");

# ##############################################################################
#
# AQO works after moving to another schema
Expand Down