diskquota
diskquota copied to clipboard
diskquota not working after reaching max_table_segments limit
- set minimum cache size
gpconfig -c diskquota.max_table_segments -v 6400
- run sql
CREATE EXTENSION diskquota;
CREATE EXTENSION
SELECT diskquota.set_schema_quota(current_schema, '1MB');
set_schema_quota
------------------
(1 row)
SET client_min_messages = WARNING;
SET
CREATE TABLE t(a int, b int) DISTRIBUTED BY (a) PARTITION BY RANGE (b) (START (1) END (100) EVERY (1));
CREATE TABLE
CREATE TABLE tt(a int, b int) DISTRIBUTED BY (a) PARTITION BY RANGE (b) (START (1) END (100) EVERY (1));
CREATE TABLE
RESET client_min_messages;
RESET
SELECT diskquota.wait_for_worker_new_epoch();
wait_for_worker_new_epoch
---------------------------
t
(1 row)
SELECT * FROM diskquota.show_fast_schema_quota_view;
schema_name | schema_oid | quota_in_mb | nspsize_in_bytes
-------------+------------+-------------+------------------
postgres | 21746 | 1 | 0
(1 row)
INSERT INTO t SELECT i, i FROM generate_series(1, 9) i;
INSERT 0 9
INSERT INTO tt SELECT i, i FROM generate_series(1, 9) i;
INSERT 0 9
SELECT diskquota.wait_for_worker_new_epoch();
wait_for_worker_new_epoch
---------------------------
t
(1 row)
SELECT * FROM diskquota.show_fast_schema_quota_view;
schema_name | schema_oid | quota_in_mb | nspsize_in_bytes
-------------+------------+-------------+------------------
postgres | 21746 | 1 | 294912
(1 row)
\dt+ tt_1_prt_1
List of relations
Schema | Name | Type | Owner | Storage | Size | Description
----------+------------+-------+----------+---------+-------+-------------
postgres | tt_1_prt_1 | table | postgres | heap | 32 kB |
(1 row)
INSERT INTO tt SELECT i, 1 FROM generate_series(1, 99999) i;
INSERT 0 99999
SELECT diskquota.wait_for_worker_new_epoch();
wait_for_worker_new_epoch
---------------------------
t
(1 row)
SELECT * FROM diskquota.show_fast_schema_quota_view;
schema_name | schema_oid | quota_in_mb | nspsize_in_bytes
-------------+------------+-------------+------------------
postgres | 21746 | 1 | 294912
(1 row)
\dt+ tt_1_prt_1
List of relations
Schema | Name | Type | Owner | Storage | Size | Description
----------+------------+-------+----------+---------+---------+-------------
postgres | tt_1_prt_1 | table | postgres | heap | 3840 kB |
(1 row)
INSERT INTO tt SELECT i, 1 FROM generate_series(1, 99999) i;
INSERT 0 99999
SELECT diskquota.wait_for_worker_new_epoch();
wait_for_worker_new_epoch
---------------------------
t
(1 row)
SELECT * FROM diskquota.show_fast_schema_quota_view;
schema_name | schema_oid | quota_in_mb | nspsize_in_bytes
-------------+------------+-------------+------------------
postgres | 21746 | 1 | 294912
(1 row)
\dt+ tt_1_prt_1
List of relations
Schema | Name | Type | Owner | Storage | Size | Description
----------+------------+-------+----------+---------+---------+-------------
postgres | tt_1_prt_1 | table | postgres | heap | 7392 kB |
(1 row)