mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-23 17:36:28 +00:00
* Initial commit * Cleanup and add stats * Use an arc instead of full clones to store the parse packets * Use mutex instead * fmt * clippy * fmt * fix? * fix? * fmt * typo * Update docs * Refactor custom protocol * fmt * move custom protocol handling to before parsing * Support describe * Add LRU for server side statement cache * rename variable * Refactoring * Move docs * Fix test * fix * Update tests * trigger build * Add more tests * Reorder handling sync * Support when a named describe is sent along with Parse (go pgx) and expecting results * don't talk to client if not needed when client sends Parse * fmt :( * refactor tests * nit * Reduce hashing * Reducing work done to decode describe and parse messages * minor refactor * Merge branch 'main' into zain/reimplment-prepared-statements-with-global-lru-cache * Rewrite extended and prepared protocol message handling to better support mocking response packets and close * An attempt to better handle if there are DDL changes that might break cached plans with ideas about how to further improve it * fix * Minor stats fixed and cleanup * Cosmetic fixes (#64) * Cosmetic fixes * fix test * Change server drop for statement cache error to a `deallocate all` * Updated comments and added new idea for handling DDL changes impacting cached plans * fix test? * Revert test change * trigger build, flakey test * Avoid potential race conditions by changing get_or_insert to promote for pool LRU * remove ps enabled variable on the server in favor of using an option * Add close to the Extended Protocol buffer --------- Co-authored-by: Lev Kokotov <levkk@users.noreply.github.com>
39 lines
938 B
PL/PgSQL
39 lines
938 B
PL/PgSQL
|
|
-- \setrandom aid 1 :naccounts
|
|
\set aid random(1, 100000)
|
|
-- \setrandom bid 1 :nbranches
|
|
\set bid random(1, 100000)
|
|
-- \setrandom tid 1 :ntellers
|
|
\set tid random(1, 100000)
|
|
-- \setrandom delta -5000 5000
|
|
\set delta random(-5000,5000)
|
|
|
|
\set shard random(0, 2)
|
|
|
|
SET SHARD TO :shard;
|
|
|
|
SET SERVER ROLE TO 'auto';
|
|
|
|
BEGIN;
|
|
|
|
UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
|
|
|
|
SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
|
|
|
|
UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
|
|
|
|
UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
|
|
|
|
INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
|
|
|
|
END;
|
|
|
|
SET SHARDING KEY TO :aid;
|
|
|
|
-- Read load balancing
|
|
SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
|
|
|
|
SET SERVER ROLE TO 'replica';
|
|
|
|
-- Read load balancing
|
|
SELECT abalance FROM pgbench_accounts WHERE aid = :aid; |