Skip site navigation (1) Skip section navigation (2)

Re: Slow subquery on large dataset

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: bob_bamber(at)hotmail(dot)com (Bob)
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Slow subquery on large dataset
Date: 2004-02-21 06:58:52
Message-ID: 9923.1077346732@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
bob_bamber(at)hotmail(dot)com (Bob) writes:
> I'm having some performance issues when querying a couple of tables
> containing a large amount of data.

> foo=# SELECT data_id FROM capacity_data WHERE data_id NOT IN (SELECT
> data_id FROM capacities);

Try PG 7.4, or if you're on 7.4, try increasing sort_mem.  IN and NOT IN
have pretty sucky performance in earlier releases.  (If you can't
upgrade for some reason, you could try using EXISTS instead of IN.)

			regards, tom lane

In response to

pgsql-novice by date

Next:From: joseph speigleDate: 2004-02-21 10:26:13
Subject: Re: Create Rule
Previous:From: V i s h a l Kashyap @ [Sai Hertz And Control Systems]Date: 2004-02-21 06:16:50
Subject: Re: HTML email

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group