X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id CF9D0D1B457 for ; Fri, 5 Dec 2003 02:07:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 66891-05 for ; Thu, 4 Dec 2003 22:07:28 -0400 (AST) Received: from uhh.alcaron.ee (uhh.alcaron.ee [194.204.62.169]) by svr1.postgresql.org (Postfix) with ESMTP id E91A3D1B43A for ; Thu, 4 Dec 2003 22:07:24 -0400 (AST) Received: from iff by uhh.alcaron.ee with local id 1AS5NQ-0005bY-00; Fri, 05 Dec 2003 04:07:28 +0200 Date: Fri, 5 Dec 2003 04:07:28 +0200 To: pgsql-performance@postgresql.org Subject: Re: Slow UPADTE, compared to INSERT Message-ID: <20031205020728.GA21440@alcaron.ee> References: <20031204185751.GA15893@alcaron.ee> <200312042023.37050.dev@archonet.com> <20031204221312.GA18874@alcaron.ee> <200312042245.21899.dev@archonet.com> <20031205014514.GA21079@alcaron.ee> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031205014514.GA21079@alcaron.ee> User-Agent: Mutt/1.3.28i From: Ivar Zarans X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/114 X-Sequence-Number: 4974 I have played around with explain and explain analyze and noticed one interesting oddity: === explain UPDATE table1 SET status = 'SKIP' WHERE recid = 196641; Seq Scan on table1 (cost=0.00..16709.97 rows=1 width=199) Filter: (recid = 196641) === explain UPDATE table1 SET status = 'SKIP' WHERE recid = '196641'; Index Scan using table1_pkey on table1 (cost=0.00..6.01 rows=1 width=199) Index Cond: (recid = 196641::bigint) === explain UPDATE table1 SET status = 'SKIP' WHERE recid = 196641::bigint; Index Scan using table1_pkey on table1 (cost=0.00..6.01 rows=1 width=199) Index Cond: (recid = 196641::bigint) === Why first example, where recid is given as numeric constant, is using sequential scan, but second example, where recid is given as string constant works with index scan, as expected? Third example shows, that numeric constant must be typecasted in order to function properly. Is this normal behaviour of fields with bigint type? -- Ivar Zarans