pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvar Freude <alvar@a-blast.org>
To: Eric <emayo@pozicom.net>
To: pgsql-sql@postgresql.org
Subject: Re: 2 Selects 1 is faster, why?
Date: Wed, 26 Jun 2002 17:34:47 +0200
Message-ID: <1371510000.1025105687@gnarzelwicht.delirium-arts.de> (raw)
In-Reply-To: <afag3c$kce$1@news.hub.org>
References: <afag3c$kce$1@news.hub.org>

Hi,

-- Eric <emayo@pozicom.net> wrote:

> If I perform the following 2 selects, the first one is EXTREMELY slow
> where the 2nd one is very fast.

[...] 

> Why would 2 be so much faster?  I have ran the EXPLAIN on this and index
> scans are being used.

I guess, the first query has to search for all ol.orderid the equivalent
o.orderid; the second variant only has to search for '1234' in each
?.orderid, which is much faster.

Explizit joins should speed up this!


> NOTE: The actual queries return more information than this, but the
> fundamental change shown above seems to give me the instant response I am
> looking for. (1) takes about 60 seconds to run and (2) takes 3-5 seconds
> to run.

3-5 seconds seems very long to me, if indexes are used and the result is
not a set of thousands of rows; are you sure?


Ciao
  Alvar
 

-- 
// Unterschreiben!      http://www.odem.org/informationsfreiheit/
// Internet am Telefon: http://www.teletrust.info/
// Das freieste Medium? http://www.odem.org/insert_coin/
// Blaster:             http://www.assoziations-blaster.de/






view thread (5+ messages)  latest in thread

Message-ID: <1371510000.1025105687@gnarzelwicht.delirium-arts.de>
Permalink:  ../1371510000.1025105687@gnarzelwicht.delirium-arts.de/
Also on:    postgresql.org/message-id/1371510000.1025105687@gnarzelwicht.delirium-arts.de

 · 

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: alvar@a-blast.org, emayo@pozicom.net
  Subject: Re: 2 Selects 1 is faster, why?
  In-Reply-To: <1371510000.1025105687@gnarzelwicht.delirium-arts.de>

* 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