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

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

What does this show in explain? Does it use an index?

select name from games where mfr = ''

>
> 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

I ran this test:

test=> explain select * from pg_proc where oid in (select oid from
pg_proc where oid =3);
NOTICE: QUERY PLAN:

Seq Scan on pg_proc (cost=48.90 size=91 width=122)
SubPlan
-> Index Scan on pg_proc (cost=2.05 size=1 width=4)

and it used the index in the subquery. Please let us about the above
test.

--
Bruce Momjian | 830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us | Drexel Hill, Pennsylvania 19026
+ If your life is a hard drive, | (610) 353-9879(w)
+ Christ can be your backup. | (610) 853-3000(h)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-03-22 03:32:13 Re: [HACKERS] Newest Patch...try this one...
Previous Message Bruce Momjian 1998-03-22 03:03:14 Re: [HACKERS] 6.3p1 CHANGES