Received: from email03.aon.at (WARSL401PIP7.highway.telekom.at [195.3.96.115]) by postgresql.org (8.11.3/8.11.4) with SMTP id fB4Kxcm16394 for ; Tue, 4 Dec 2001 15:59:39 -0500 (EST) (envelope-from i.hasenoehrl@aon.at) Received: (qmail 613626 invoked from network); 4 Dec 2001 20:59:31 -0000 Received: from n649p026.adsl.highway.telekom.at (HELO irina) ([62.47.25.26]) (envelope-sender ) by qmail3.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 4 Dec 2001 20:59:31 -0000 Message-ID: <004a01c17d06$5f61b840$01011eac@irina> From: =?iso-8859-1?Q?DI_Hasen=F6hrl?= To: Subject: make query faster?? Date: Tue, 4 Dec 2001 21:58:06 +0100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0047_01C17D0E.C0FCED60" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Archive-Number: 200112/38 X-Sequence-Number: 5861 This is a multi-part message in MIME format. ------=_NextPart_000_0047_01C17D0E.C0FCED60 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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=3D341.63..341.63* mean? I couldn't find an explanatio= n 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=3D341.63..341.63 rows=3D3809 width=3D96) -> Seq Scan on artikel (cost=3D0.00..115.09 rows=3D3809 width=3D96) EXPLAIN WAWI=3D# 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=3D0.00..115.09 rows=3D3809 width=3D96) EXPLAIN WAWI=3D#=20=20=20=20 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 th= an an indexscan. What's an explicit sort????????=20=20=20 ------=_NextPart_000_0047_01C17D0E.C0FCED60 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi,
I've a simple query, but when I use *ORDER= BY* it=20 takes a long time till I can see the result.
 
a_nr is varchar(20) and the primary key of= my table=20 artikel.
 
Please, can someone give me a hint, how to= improve=20 my query.
Many thanks in advance
 
-Irina
 
P.S.: what does *cost=3D341.63..341.63* me= an? I=20 couldn't find an explanation in the archives!
 
WAWI-# select=20 a_nr,a_bez1,a_bez2,a_bez3,a_bez4,a_gewicht,a_bruttog,kl_ean,a_vol fr= om=20 artikel order by a_nr;
NOTICE:  QUERY=20 PLAN:
 
Sort  (cost=3D341.63..341.6= 3=20 rows=3D3809 width=3D96)
  ->  Seq Scan on artike= l =20 (cost=3D0.00..115.09 rows=3D3809 width=3D96)
EXPLAIN

WAWI=3D# explain
WAWI-# select=20 a_nr,a_bez1,a_bez2,a_bez3,a_bez4,a_gewicht,a_bruttog,kl_ean,a_vol fr= om=20 artikel;
NOTICE:  QUERY PLAN:
 
Seq Scan on artikel  (cost=3D0.00..= 115.09=20 rows=3D3809 width=3D96)
 
EXPLAIN
WAWI=3D#    
 
In Bruce Momjian's book I r= ead, that=20 indexes are usually not used for ORDER BY operations: a sequential scan fol= lowed=20 by an explicit sort is fatser than an indexscan.
 
What's an explicit=20 sort????????  
------=_NextPart_000_0047_01C17D0E.C0FCED60--