pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ivar Zarans <iff@alcaron.ee>
To: pgsql-performance@postgresql.org
Subject: Re: Slow UPADTE, compared to INSERT
Date: Fri, 5 Dec 2003 04:07:28 +0200
Message-ID: <20031205020728.GA21440@alcaron.ee> (raw)
In-Reply-To: <20031205014514.GA21079@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>


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




view thread (24+ messages)  latest in thread

Message-ID: <20031205020728.GA21440@alcaron.ee>
Permalink:  ../20031205020728.GA21440@alcaron.ee/
Also on:    postgresql.org/message-id/20031205020728.GA21440@alcaron.ee

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: iff@alcaron.ee
  Subject: Re: Slow UPADTE, compared to INSERT
  In-Reply-To: <20031205020728.GA21440@alcaron.ee>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox