pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: pginfo <pginfo@t1.unisoftbg.com>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: problem with max and not using index on PK
Date: Sat, 03 May 2003 11:12:22 +0200
Message-ID: <3EB387F6.F3230162@t1.unisoftbg.com> (raw)

Hi,
I am using PG 7.3.1

The query plan is:

mydb=# explain analyze select max(IDS) from t_sk10;
                                                       QUERY PLAN
------------------------------------------------------------------------------------------------------------------------

 Aggregate  (cost=61742.78..61742.78 rows=1 width=64) (actual
time=11221.42..11221.43 rows=1 loops=1)
   ->  Seq Scan on t_sk10  (cost=0.00..60076.22 rows=666622 width=64)
(actual time=16.59..9968.00 rows=666622 loops=1)
 Total runtime: 11221.50 msec
(3 rows)

Time: 11222.68 ms

The time is very big.
For example if I start it on oracle, it take ~ 100 ms !

The column IDS is the PK. It is declared as name.
I do not know the reason for not using index in this case.

Also if I get another (not indexed column) and start also max, PG i
working 4 time quicker as oracle and it is great.

Regards,
ivan.




view thread (3+ messages)  latest in thread

Message-ID: <3EB387F6.F3230162@t1.unisoftbg.com>
Permalink:  ../3EB387F6.F3230162@t1.unisoftbg.com/
Also on:    postgresql.org/message-id/3EB387F6.F3230162@t1.unisoftbg.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-sql@postgresql.org
  Cc: pginfo@t1.unisoftbg.com
  Subject: Re: problem with max and not using index on PK
  In-Reply-To: <3EB387F6.F3230162@t1.unisoftbg.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