pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: DI Hasenöhrl <i.hasenoehrl@aon.at>
To: pgsql-sql@postgresql.org
Subject: make query faster??
Date: Tue, 4 Dec 2001 21:58:06 +0100
Message-ID: <004a01c17d06$5f61b840$01011eac@irina> (raw)

Hi,
I've a simple query, but when I use *ORDER BY* it takes a long time till I can see the result.

a_nr is varchar(20) and the primary key of my table artikel.

Please, can someone give me a hint, how to improve my query.
Many thanks in advance

-Irina

P.S.: what does *cost=341.63..341.63* mean? I couldn't find an explanation in the archives!

  WAWI-# select a_nr,a_bez1,a_bez2,a_bez3,a_bez4,a_gewicht,a_bruttog,kl_ean,a_vol from artikel order by a_nr;
  NOTICE:  QUERY PLAN:

  Sort  (cost=341.63..341.63 rows=3809 width=96)
    ->  Seq Scan on artikel  (cost=0.00..115.09 rows=3809 width=96)
  EXPLAIN

  WAWI=# explain
  WAWI-# select a_nr,a_bez1,a_bez2,a_bez3,a_bez4,a_gewicht,a_bruttog,kl_ean,a_vol from artikel;
  NOTICE:  QUERY PLAN:

  Seq Scan on artikel  (cost=0.00..115.09 rows=3809 width=96)

  EXPLAIN
  WAWI=#    

In Bruce Momjian's book I read, that indexes are usually not used for ORDER BY operations: a sequential scan followed by an explicit sort is fatser than an indexscan.

What's an explicit sort????????   

view thread (4+ messages)  latest in thread

Message-ID: <004a01c17d06$5f61b840$01011eac@irina>
Permalink:  ../004a01c17d06$5f61b840$01011eac@irina/
Also on:    postgresql.org/message-id/004a01c17d06$5f61b840$01011eac@irina

 · 

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: i.hasenoehrl@aon.at
  Subject: Re: make query faster??
  In-Reply-To: <004a01c17d06$5f61b840$01011eac@irina>

* 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