[setup_primary] sql = """ DROP EXTENSION IF EXISTS pg_search CASCADE; DROP TABLE IF EXISTS test CASCADE; CREATE EXTENSION pg_search; CREATE TABLE test ( id SERIAL8 NOT NULL PRIMARY KEY, message TEXT, old_message TEXT ) WITH (autovacuum_enabled = false); INSERT INTO test (message) VALUES ('beer wine cheese a'); INSERT INTO test (message) VALUES ('beer wine a'); INSERT INTO test (message) VALUES ('beer cheese a'); INSERT INTO test (message) VALUES ('beer a'); INSERT INTO test (message) VALUES ('wine cheese a'); INSERT INTO test (message) VALUES ('wine a'); INSERT INTO test (message) VALUES ('cheese a'); INSERT INTO test (message) VALUES ('beer wine cheese a'); INSERT INTO test (message) VALUES ('beer wine a'); INSERT INTO test (message) VALUES ('beer cheese a'); INSERT INTO test (message) VALUES ('beer a'); INSERT INTO test (message) VALUES ('wine cheese a'); INSERT INTO test (message) VALUES ('wine a'); INSERT INTO test (message) VALUES ('cheese a'); -- INSERT INTO test (message) SELECT 'space fillter ' || x FROM generate_series(1, 10000000) x; CREATE INDEX idxtest ON test USING bm25(id, message) WITH (key_field = 'id'); CREATE OR REPLACE FUNCTION assert(a bigint, b bigint) RETURNS bool STABLE STRICT LANGUAGE plpgsql AS $$ DECLARE current_txid bigint; BEGIN -- Get the current transaction ID current_txid := txid_current(); -- Check if the values are not equal IF a <> b THEN RAISE EXCEPTION 'Assertion failed: % <> %. Transaction ID: %', a, b, current_txid; END IF; RETURN true; END; $$; """ [teardown] sql = """ -- DROP TABLE test CASCADE; -- DROP EXTENSION pg_search CASCADE; """ [monitor] refresh_ms = 100 title = "Index Info Monitor" sql = """ SELECT segno, visible, recyclable, xmax, num_docs, num_deleted, byte_size FROM paradedb.index_info('idxtest', true) ORDER BY num_deleted DESC, byte_size DESC, segno ASC; """ [[jobs]] refresh_ms = 5 title = "Index Size Info" sql = """ SELECT count(*) FILTER (WHERE visible) AS visible, count(*) FILTER (WHERE recyclable) AS recyclable, pg_relation_size('idxtest') / 8192 AS pages, pg_relation_size('idxtest'), pg_size_pretty(pg_relation_size('idxtest')), (select pg_size_pretty(sum(byte_size)) from paradedb.index_info('idxtest', true)) as tantivy_size, paradedb.is_merging('idxtest') FROM paradedb.index_info('idxtest', true); """ [[jobs]] refresh_ms = 1 title = "Custom Scan" on_connect = """ SET enable_indexonlyscan to OFF; SET enable_indexscan to OFF; """ sql = """ SELECT assert(count(*), 8), count(*) FROM test where id @@@ 'message:beer'; """ [[jobs]] refresh_ms = 1 title = "Parallel Custom Scan" on_connect = """ SET enable_indexonlyscan to OFF; SET enable_indexscan to OFF; SET debug_parallel_query TO ON; """ sql = """ SELECT count(*) FROM test WHERE id @@@ 'message:beer'; """ assert = "8" [[jobs]] refresh_ms = 1 title = "Index Only Scan" on_connect = """ set max_parallel_workers = 0; set paradedb.enable_custom_scan to off; """ sql = """ SELECT assert(count(*), 8), count(*) FROM test where id @@@ 'message:wine'; """ [[jobs]] refresh_ms = 1 window_height = 1 title = "Find by ctid" sql = """ select ctid::text, id, message, old_message, paradedb.find_ctid('idxtest', ctid) as segment_ids, now()::text, txid_current()::numeric from test where message ilike '%beer%' order by id; """ [[jobs]] refresh_ms = 1 atomic_connection = false title = "Update 1..9" cancel_keycode = 'U' sql = """ UPDATE test SET message = array_to_string((string_to_array(message, ' '))[1:array_upper(string_to_array(message, ' '), 1) - 1], ' ') || ' ' || txid_current() || ctid, old_message = message WHERE id < 10; SELECT assert(count(*), 8) FROM test WHERE id @@@ 'message:beer'; """ [[jobs]] refresh_ms = 1 atomic_connection = false title = "Update 10,11" cancel_keycode = 'U' sql = """ BEGIN; UPDATE test SET message = array_to_string((string_to_array(message, ' '))[1:array_upper(string_to_array(message, ' '), 1) - 1], ' ') || ' ' || txid_current(), old_message = message WHERE id IN (10, 11); ABORT; """ [[jobs]] title = "Insert Row" refresh_ms = 1 atomic_connection = true sql = """ INSERT INTO test (message) VALUES ('test'); """ [[jobs]] title = "Insert Row" refresh_ms = 1 atomic_connection = true sql = """ INSERT INTO test (message) VALUES ('test'); """ [[jobs]] title = "Update 15..18" refresh_ms = 1 atomic_connection = true sql = """ UPDATE test SET message = message || ' ' WHERE id between 15 and 18 """ [[jobs]] title = "Update 20..25" refresh_ms = 1 atomic_connection = true sql = """ UPDATE test SET message = message || ' ' WHERE id between 20 and 25 """ [[jobs]] title = "Update 40..150" refresh_ms = 1 atomic_connection = true sql = """ UPDATE test SET message = message || ' ' WHERE id between 40 and 150 """ [[jobs]] title = "Delete values" refresh_ms = 1 pause_keycode = 'd' cancel_keycode = 'D' atomic_connection = true sql = """ DELETE FROM test WHERE id > 1000; """ [[jobs]] refresh_ms = 1 cancel_keycode = 'V' title = "Vacuum" sql = "VACUUM (parallel 32, index_cleanup on) test"