[BUGS] pgbench % output incorrect with large scales

2012-10-20 Thread Thom Brown
Hi all,

I've run pgbench with a scale of 2000, and have noticed that the %
done goes a bit wonky:

thom@bison:~$ pgbench -i -s 2000 pgbench
NOTICE:  table "pgbench_history" does not exist, skipping
NOTICE:  table "pgbench_tellers" does not exist, skipping
NOTICE:  table "pgbench_accounts" does not exist, skipping
NOTICE:  table "pgbench_branches" does not exist, skipping
creating tables...
10 of 2 tuples (0%) done.
20 of 2 tuples (0%) done.
30 of 2 tuples (0%) done.
...
200 of 2 tuples (1%) done.
...
2000 of 2 tuples (10%) done.
...
2150 of 2 tuples (-10%) done.
...
2300 of 2 tuples (-9%) done.
...
3100 of 2 tuples (-5%) done.
...
4100 of 2 tuples (0%) done.

and so on, and so forth.

Presumably this is just an int overflowing repeatedly.

-- 
Thom


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] pgbench % output incorrect with large scales

2012-10-20 Thread Tom Lane
Thom Brown  writes:
> I've run pgbench with a scale of 2000, and have noticed that the %
> done goes a bit wonky:
> ...
> Presumably this is just an int overflowing repeatedly.

Yeah, fixed.  Thanks for the report!

(FWIW, you're not all that far away from the threshold where the integer
table columns wouldn't be wide enough.  I don't think we want to change
those datatypes, though.)

regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] BUG #7525: Deferred unique index with predicate

2012-10-20 Thread Jeff Davis
On Sat, 2012-09-08 at 12:40 +, rikard.pave...@zg.htnet.hr wrote:
> The following bug has been logged on the website:
> 
> Bug reference:  7525
> Logged by:  Rikard Pavelic
> Email address:  rikard.pave...@zg.htnet.hr
> PostgreSQL version: 9.1.2
> Operating system:   Windows 7
> Description:
> 
> Is there a way in Postgres to create a unique constraint with predicate or
> an unique index which is deferred?
> 
> Depesz said not yet.
> http://www.depesz.com/2009/08/11/waiting-for-8-5-deferrable-uniqueness/

Both features exist.

http://www.postgresql.org/docs/9.2/static/sql-createtable.html

  CREATE TABLE xyz(i int, j int, unique (i) deferrable);

To create a unique index with a predicate, do:

  CREATE UNIQUE INDEX xyz_uniq_idx ON xyz(j) WHERE j > 10; 

However, it can't both be deferrable and have a predicate. In order to
do that, you need to use an exclusion constraint:

http://www.postgresql.org/docs/9.2/static/sql-createtable.html#SQL-CREATETABLE-EXCLUDE

To make it equivalent to UNIQUE, set all operators to "=", e.g.:

  CREATE TABLE xyz(i int, exclude (i WITH =) where (i > 10) deferrable);

Regards,
Jeff Davis



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs