Re: Slow UPADTE, compared to INSERT

From: Ivar Zarans <iff(at)alcaron(dot)ee>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Slow UPADTE, compared to INSERT
Date: 2003-12-05 02:07:28
Message-ID: 20031205020728.GA21440@alcaron.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-12-05 02:15:52 Re: Slow UPADTE, compared to INSERT
Previous Message Ivar Zarans 2003-12-05 01:45:14 Re: Slow UPADTE, compared to INSERT