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

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [HACKERS] psql nested queries with 2000+ records
Дата
Msg-id 199803211454.JAA06103@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] psql nested queries with 2000+ records  (Coronach <coronach@hill-b-073.resnet.purdue.edu>)
Ответы Re: [HACKERS] psql nested queries with 2000+ records  (Coronach <coronach@hill-b-073.resnet.purdue.edu>)
Список 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@candle.pha.pa.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)

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] tables >2GB
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] 6.3p1 CHANGES