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: 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 14:54:54
Message-ID: 199803211454.JAA06103@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> >select * into games2 from games;
>
> amusements=> select * into games2 from games;
> ERROR: parser: parse error at or near "games2"

Oops, we haven't released 6.3p1 yet, so 'select * into table games2 from
games;'

>
> But, I just dumped it and changed a few things to fit the scenario...
>
> >explain select name from games where name in (select name from games2 where
> >name like 'A%');
>
> amusements=> explain select name from games where name in (select name from
> game
> s2 where name like 'A%');
> 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
>
> Upon execution of the query, it still took quite a long time.
>
> >causing the problem. I assume you have run vacuum and vacuum analyze.
>
> Yep, ran vacuum on it and also had it work with newly generated databases too.

Try it without the LIKE, with just an equals.

--
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-21 14:56:58 Re: [HACKERS] tables >2GB
Previous Message Thomas G. Lockhart 1998-03-21 14:17:43 Re: [HACKERS] 6.3p1 CHANGES