Thread: pgbench not setting scale size correctly?

pgbench not setting scale size correctly?

From
Enrico Sirola
Date:
Hello,
I'm trying to perform some benchmarks using pgbench. I'm using the
following rpm package:

postgresql-contrib-8.3.0-2PGDG.rhel5

for x86_64, downloaded from the pgsql yum repository for centos5/amd64.
When I init the pgbench database, the scale factor seems to work,
however when performing the benchmark I get the following output:

sudo -u postgres pgbench -c 10 -t 1000 -s 1000  pgbench
starting vacuum...end.
transaction type: TPC-B (sort of)
scaling factor: 1
number of clients: 10
number of transactions per client: 1000
number of transactions actually processed: 10000/10000
tps = 2034.588824 (including connections establishing)
tps = 2047.924715 (excluding connections establishing)

as you see, the reported scaling factor is 1, but I specified -s 1000,
which seems strange... I'm going to recompile it from the sources now.
Didn't I get anything or there is a bug somewhere?
Thanks for your help,
Enrico


Re: pgbench not setting scale size correctly?

From
"Pavan Deolasee"
Date:
On Fri, Mar 14, 2008 at 2:34 PM, Enrico Sirola <enrico.sirola@gmail.com> wrote:
>
>  as you see, the reported scaling factor is 1, but I specified -s 1000,
>  which seems strange... I'm going to recompile it from the sources now.
>  Didn't I get anything or there is a bug somewhere?


You must have initialized pgbench with scale 1. While running the tests,
it will pick up the scale factor with which it was initialized


Thanks,
Pavan


--
Pavan Deolasee
EnterpriseDB http://www.enterprisedb.com

Re: pgbench not setting scale size correctly?

From
Tom Lane
Date:
"Pavan Deolasee" <pavan.deolasee@gmail.com> writes:
> On Fri, Mar 14, 2008 at 2:34 PM, Enrico Sirola <enrico.sirola@gmail.com> wrote:
>> as you see, the reported scaling factor is 1, but I specified -s 1000,

> You must have initialized pgbench with scale 1.

Yeah, -s is only meaningful when given with -i.  Maybe someday we ought
to fix pgbench to complain if you try to set it at other times.

            regards, tom lane

Re: pgbench not setting scale size correctly?

From
Greg Smith
Date:
On Fri, 14 Mar 2008, Tom Lane wrote:

> "Pavan Deolasee" <pavan.deolasee@gmail.com> writes:
>> You must have initialized pgbench with scale 1.
>
> Yeah, -s is only meaningful when given with -i.  Maybe someday we ought
> to fix pgbench to complain if you try to set it at other times.

You have to pass -s in to the actual run if you're specifying your own
custom script(s) using -f and you want the :scale variable to be defined.
But if you're running one of the internal scripts, it just looks in the
database instead, overriding whatever you pass.

The way the option parsing code is done would make complaining in the case
where your parameter is ignored a bit of a contortion.  The part that
detects based on the database is after all the other parsing because the
connection has to be brought up first.  This is somewhat documented as of
8.3 (I think I submitted that); see the notes on "-s" in
http://www.postgresql.org/docs/current/static/pgbench.html#PGBENCH-RUN-OPTIONS

That could be clearer though, it makes it sound like it's a display only
thing where it's actually quite functional if your custom script uses
scale.  I have another pgbench doc patch I'm working on, when I get that
done I'll correct this as well.

--
* Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD

Re: pgbench not setting scale size correctly?

From
Tom Lane
Date:
Greg Smith <gsmith@gregsmith.com> writes:
> On Fri, 14 Mar 2008, Tom Lane wrote:
>> Yeah, -s is only meaningful when given with -i.  Maybe someday we ought
>> to fix pgbench to complain if you try to set it at other times.

> You have to pass -s in to the actual run if you're specifying your own
> custom script(s) using -f and you want the :scale variable to be defined.

Right, I knew that at one time ;-)

> The way the option parsing code is done would make complaining in the case
> where your parameter is ignored a bit of a contortion.  The part that
> detects based on the database is after all the other parsing because the
> connection has to be brought up first.

Yeah.  But couldn't we have that part issue a warning if -s had been set
on the command line?

            regards, tom lane

Re: pgbench not setting scale size correctly?

From
Justin
Date:


Tom Lane wrote:
Greg Smith <gsmith@gregsmith.com> writes: 
On Fri, 14 Mar 2008, Tom Lane wrote:   
Yeah, -s is only meaningful when given with -i.  Maybe someday we ought
to fix pgbench to complain if you try to set it at other times.     
 
You have to pass -s in to the actual run if you're specifying your own 
custom script(s) using -f and you want the :scale variable to be defined.    
Right, I knew that at one time ;-)
 
The way the option parsing code is done would make complaining in the case 
where your parameter is ignored a bit of a contortion.  The part that 
detects based on the database is after all the other parsing because the 
connection has to be brought up first.   
Yeah.  But couldn't we have that part issue a warning if -s had been set
on the command line?
		regards, tom lane
 
I was wondering why the -s would  not rescale the data? 

IMHO a warning would be fine

Re: pgbench not setting scale size correctly?

From
Tom Lane
Date:
Justin <justin@emproshunts.com> writes:
> I was wondering why the -s would  not rescale the data?

That would involve re-initializing the table contents.
If that's what you want, use -i.

            regards, tom lane

Re: pgbench not setting scale size correctly?

From
Greg Smith
Date:
On Fri, 14 Mar 2008, Justin wrote:

> I was wondering why the -s would  not rescale the data?

First, you don't know how to rescale the data if someone is passing in a
custom script.  More importantly, people don't expect the benchmark tool
to change things in tables unless specifically requested.  I once made the
unfortunate mistake of running 'pgbench -i' against the wrong database,
one that just happened to have a table named 'accounts' in it, only to
watch that table get destroyed.  It would be unwise to make that behavior
easier to trigger.

pgbench is a fairly flexible tool that supports creating simple scripted
tests for a variety of purpose.  It just so happens that most people only
ever use the default tests where it seems things could be simplified.
They could, but it would take some of the flexibility out as well.

--
* Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD

Re: pgbench not setting scale size correctly?

From
Justin
Date:


Tom Lane wrote:
Justin <justin@emproshunts.com> writes: 
I was wondering why the -s would  not rescale the data?    
That would involve re-initializing the table contents.
If that's what you want, use -i.
		regards, tom lane
 
thanks

Re: pgbench not setting scale size correctly?

From
Justin
Date:
Greg Smith wrote:
> On Fri, 14 Mar 2008, Justin wrote:
>
>> I was wondering why the -s would  not rescale the data?
>
> First, you don't know how to rescale the data if someone is passing in
> a custom script.  More importantly, people don't expect the benchmark
> tool to change things in tables unless specifically requested.  I once
> made the unfortunate mistake of running 'pgbench -i' against the wrong
> database, one that just happened to have a table named 'accounts' in
> it, only to watch that table get destroyed.  It would be unwise to
> make that behavior easier to trigger.
>
> pgbench is a fairly flexible tool that supports creating simple
> scripted tests for a variety of purpose.  It just so happens that most
> people only ever use the default tests where it seems things could be
> simplified. They could, but it would take some of the flexibility out
> as well.
>
> --
> * Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD
>
OK,  what if it warns on the -s is set  when missing -i and when ( -i
and -f is set in the same command) ???