Hi, In a custom pgbench script, it seems convenient to be able to split a really long query to span multiple lines using an escape character (bash-style). Attached adds that capability to read_line_from_file() in pgbench.c
For example,
BEGIN;
\setrandom 1 16500000
UPDATE table \
SET col2 = (clock_timestamp() + '10s'::interval * random() * 1000), \
col3 = (clock_timestamp() + '10s'::interval * sin(random() *
(2*pi()) ) * 1000) \
WHERE col1 = :id;
COMMIT;
instead of:
BEGIN;
\setrandom id 1 16500000
UPDATE table SET col2 = (clock_timestamp() + '10s'::interval *
random() * :id), col3 = (clock_timestamp() + '10s'::interval *
sin(random() * (2*pi()) ) * 100000) WHERE col1 = :id;
COMMIT;
Thoughts?
--
Amit
pgbench-custom-script-line-continuation.patch
Description: Binary data
-- Sent via pgsql-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
