pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gaetano Mendola <mendola@bigfoot.com>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: 2 rows expected on a primary key
Date: Thu, 17 Mar 2005 13:02:58 +0100
Message-ID: <423971F2.3050701@bigfoot.com> (raw)

-----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-----




Message-ID: <423971F2.3050701@bigfoot.com>
Permalink:  ../423971F2.3050701@bigfoot.com/
Also on:    postgresql.org/message-id/423971F2.3050701@bigfoot.com

 · 

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: mendola@bigfoot.com
  Subject: Re: 2 rows expected on a primary key
  In-Reply-To: <423971F2.3050701@bigfoot.com>

* 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