pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrus <eetasoft@online.ee>
To: pgsql-performance@postgresql.org
Subject: Query runs too long for indexed tables
Date: Tue, 4 Apr 2006 22:37:18 +0300
Message-ID: <e0ui0o$2v0m$2@news.hub.org> (raw)

I have relatively small tables (toode and rid) in fast server.
Both tables are indexed on toode field.

Following query takes long time to run.
toode field type is char(20). It is difficult to change this field type.

Any idea how to speed up this query ?

UPDATE firma1.rid SET toode=NULL
       WHERE toode IS NOT NULL AND
       toode NOT IN (SELECT TOODE      FROM firma1.TOODE);

Query returned successfully: 0 rows affected, 594813 ms execution time.

explain window shows:

Seq Scan on rid  (cost=2581.07..20862553.77 rows=51848 width=1207)
  Filter: ((toode IS NOT NULL) AND (NOT (subplan)))
  SubPlan
    ->  Materialize  (cost=2581.07..2944.41 rows=14734 width=84)
          ->  Seq Scan on toode  (cost=0.00..2350.34 rows=14734 width=84)


Andrus. 





view thread (9+ messages)  latest in thread

Message-ID: <e0ui0o$2v0m$2@news.hub.org>
Permalink:  ../e0ui0o$2v0m$2@news.hub.org/
Also on:    postgresql.org/message-id/e0ui0o$2v0m$2@news.hub.org

 · 

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: eetasoft@online.ee
  Subject: Re: Query runs too long for indexed tables
  In-Reply-To: <e0ui0o$2v0m$2@news.hub.org>

* 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