Re: assymetry updating a boolean (=FALSE faster than =TRUE)

From: "George Pavlov" <gpavlov(at)mynewplace(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: assymetry updating a boolean (=FALSE faster than =TRUE)
Date: 2006-05-24 04:57:20
Message-ID: 8C5B026B51B6854CBE88121DBF097A8615124D@ehost010-33.exch010.intermedia.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

no partial (or other) index affecting these results. just a trigger the
outcome of which was affected by the value of that particular boolean.
sorry, should have looked more carefully...

> -----Original Message-----
> From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> Sent: Tuesday, May 23, 2006 4:00 PM
> To: George Pavlov
> Cc: pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] assymetry updating a boolean (=FALSE
> faster than =TRUE)
>
> "George Pavlov" <gpavlov(at)mynewplace(dot)com> writes:
> > Here is something that seems anomalous to me: when I set a
> boolean field
> > to FALSE performance is much better than when I set it to TRUE. Any
> > reason for FALSE to be favored over TRUE?
>
> It isn't. You're measuring something else than you think you're
> measuring ... maybe a partial index? Varying effects of where the
> free space is in the table? In a test case I see no significant
> difference:
>
> regression=# create table foo(f1 int, f2 bool);
> CREATE TABLE
> regression=# insert into foo select x, true from
> generate_series(1,100000) x;
> INSERT 0 100000
> regression=# \timing
> Timing is on.
> regression=# vacuum foo;
> VACUUM
> Time: 318.153 ms
> regression=# update foo set f2 = true;
> UPDATE 100000
> Time: 2553.014 ms
> regression=# vacuum foo;
> VACUUM
> Time: 410.356 ms
> regression=# update foo set f2 = false;
> UPDATE 100000
> Time: 2453.620 ms
> regression=# vacuum foo;
> VACUUM
> Time: 405.955 ms
> regression=# update foo set f2 = true;
> UPDATE 100000
> Time: 2497.413 ms
> regression=# vacuum foo;
> VACUUM
> Time: 408.403 ms
> regression=# update foo set f2 = false;
> UPDATE 100000
> Time: 2458.824 ms
> regression=#
>
> regards, tom lane
>

Browse pgsql-general by date

  From Date Subject
Next Message nitin.groups 2006-05-24 06:42:13 Survey on Firebird
Previous Message Tom Lane 2006-05-24 03:08:58 Re: [SQL] (Ab)Using schemas and inheritance