2 rows expected on a primary key

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: 2 rows expected on a primary key
Date: 2005-03-17 12:02:58
Message-ID: 423971F2.3050701@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,
I'm running a 7.4.x engine and I'm seeing in a explain analyze:

- -> Hash (cost=4.00..4.00 rows=2 width=16) (actual time=30.542..30.542 rows=0 loops=1)
-> Index Scan using user_login_login_key on user_login ul (cost=0.00..4.00 rows=2 width=16) (actual time=30.482..30.490 rows=1 loops=1)
Index Cond: ((login)::text = 'Zoneon'::text)

why postgres perform an extimation of 2 rows knowing that column it's a primary key ?

If I do an explain analyze directly on the table I get:

# explain analyze select * from user_login where login = 'Zoneon';
QUERY PLAN
- ----------------------------------------------------------------------------------------------------------------------------------
Index Scan using user_login_login_key on user_login (cost=0.00..4.00 rows=1 width=16) (actual time=0.050..0.052 rows=1 loops=1)
Index Cond: ((login)::text = 'Zoneon'::text)
Total runtime: 4.627 ms
(3 rows)

btw, is it normal that cast ?

Regards
Gaetano Mendola

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCOXHy7UpzwH2SGd4RAgwAAJ9SMJ3OfYjv03IhhTbJ9GSLby4nfwCg5ezu
UOH8wXRsNAvWRni7GSKlMps=
=6yFm
-----END PGP SIGNATURE-----

Browse pgsql-performance by date

  From Date Subject
Next Message Ales Vojacek 2005-03-17 13:17:52 TOP 10 SQL commands and more
Previous Message Manfred Koizar 2005-03-17 11:18:28 Re: multi-column index