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

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: George Pavlov <gpavlov(at)mynewplace(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: assymetry updating a boolean (=FALSE faster than =TRUE)
Date: 2006-05-23 22:33:53
Message-ID: 20060523223353.GK64371@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, May 23, 2006 at 02:55:03PM -0700, George Pavlov wrote:
> 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?
>
> Some details:
>
> vacuum analyze my_table;
> update my_table set is_foo=FALSE where some_id = 47;
> --142 rows affected, 8047 ms execution time.
> vacuum analyze my_table;
> update my_table set is_foo=TRUE where some_id = 47;
> --142 rows affected, 48609 ms execution time.
>
> I have run these kinds of queries repeatedly and the timing above is
> representative--the setting to FALSE case is about 6 times more
> performant. The table my_table has about 105K rows and has many other
> columns of various types. Thre is a trigger on the table, but it does
> not do anything special based on this column's value. The some_id column
> is indexed. This is on PG 8.1.3 on Linux.

Are there any indexes containing is_foo?
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2006-05-23 22:55:55 Re: Why won't it index scan?
Previous Message Florian G. Pflug 2006-05-23 22:27:21 Re: background triggers?