| From: | philippe(dot)beaudoin(at)bull(dot)net |
|---|---|
| To: | pgsql-performance(at)postgresql(dot)org |
| Subject: | random char or text variable in pgbench |
| Date: | 2012-06-20 19:51:38 |
| Message-ID: | OF4538F3FB.E6DA18EC-ONC1257A23.006CA39B-C1257A23.006D4440@bull.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-performance |
Hi all,
I am currently playing with the nice pgbench tool.
I would like to build a benchmark using pgbench with customized scenarios,
in order to get something quite representative of a real workload.
I have designed a few tables, with a simple script to populate them, and
defined 3 scenarios representing typical transactions.
But I have the following issue. Some tables have CHAR (or TEXT or VARCHAR)
columns that belong to their primary key and I want to include into
pgbench scenarios statements with conditions on these CHAR columns, using
some random values generated by pgbench.
As pgbench \set, \setrandom or \setshell meta-commands only manage integer
variables, I tried to use SQL conditions like:
... where my_column = to_char(:var::integer,'00009FM') ...
with var previously defined by:
\setrandom var 1 :maxvar
Having previously loaded my_column with digits strings, I get the right
result. But ... this condition cannot use any index (tested on 9.2beta2).
As a result, I get looooooong index or table scans, which is of course not
acceptable in my benchmark as it is not representative of the real data
access path :-((
Does someone has a trick to manage random char or text variable in pgbench
?
Thanks by advance for any help.
Best regards.
Philippe Beaudoin.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Midge Brown | 2012-06-20 22:27:25 | moving tables |
| Previous Message | Shaun Thomas | 2012-06-20 15:32:19 | Re: index-only scan is missing the INCLUDE feature |