Re: [HACKERS] psql nested queries with 2000+ records

From: Coronach <coronach(at)hill-b-073(dot)resnet(dot)purdue(dot)edu>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org, vadim(at)sable(dot)krasnoyarsk(dot)su
Subject: Re: [HACKERS] psql nested queries with 2000+ records
Date: 1998-03-21 17:31:08
Message-ID: 3.0.5.32.19980321123108.007f14f0@diety.conclave.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 09:54 AM 3/21/98 -0500, Bruce Momjian wrote:

>Try it without the LIKE, with just an equals.

amusements=> explain select name from games where name in (select name from
game
s where mfr = '');
NOTICE: QUERY PLAN:

Seq Scan on games (cost=207.95 size=446 width=12)
SubPlan
-> Seq Scan on games (cost=207.95 size=1 width=12)

EXPLAIN

--

amusements=> explain select name from games where name in (select name from
game
s2 where mfr = '');
NOTICE: QUERY PLAN:

Seq Scan on games (cost=207.95 size=446 width=12)
SubPlan
-> Seq Scan on games2 (cost=10.23 size=1 width=12)

EXPLAIN

The first query approved to be lengthy, but the last query was executed and
returned rows in just a few.

I then did an explain on a query that refered to the games table within the
sub query.

amusements=> explain select name from games where name in (select name from
game
s where mfr = '');
NOTICE: QUERY PLAN:

Seq Scan on games (cost=207.95 size=446 width=12)
SubPlan
-> Seq Scan on games (cost=207.95 size=1 width=12)

EXPLAIN

For the nature of the searches that the front end send to postgres (the
database is used with a web interface), it is nec. to use the like
expression. Where should I go from here?

Thanks once again,

-Coronach(at)hill-b-073(dot)resnet(dot)purdue(dot)edu

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message The Hermit Hacker 1998-03-21 18:42:02 Re: [HACKERS] Newest Patch...try this one...
Previous Message Bruce Momjian 1998-03-21 15:16:06 Re: [HACKERS] 6.3p1 CHANGES