Re: query slows down drastically with increased number of fields

Поиск
Список
Период
Сортировка
От George Pavlov
Тема Re: query slows down drastically with increased number of fields
Дата
Msg-id 8C5B026B51B6854CBE88121DBF097A8655C484@ehost010-33.exch010.intermedia.net
обсуждение исходный текст
Ответ на query slows down drastically with increased number of fields  ("Tom Darci" <tom@nuws.com>)
Ответы Re: query slows down drastically with increased number of fields  ("Jim C. Nasby" <jim@nasby.net>)
Список pgsql-performance
i have wondered myself. i wouldn't do it through pgAdmin (not sure what
the best test it, but i thought psql from the same machine might be
better--see below). anyway, the funny thing is that if you concatenate
them the time drops:

~% time psql -dXXX -hYYY -UZZZ -c"select consumer_id from consumer" -o
/dev/null
psql -dXXX -hYYY -UZZZ -c"select consumer_id from consumer" -o   0.09s
user 0.01s system 29% cpu 0.341 total

~% time psql -dXXX -hstgdb0 -p5432 -Umnp -c"select
consumer_id,consumer_id,consumer_id,consumer_id,consumer_id,consumer_id,
consumer_id,consumer_id from consumer" -o /dev/null
psql -dXXX -hYYY -UZZZ -o /dev/null  0.76s user 0.06s system 45% cpu
1.796 total

~% time psql -dXXX -hYYY -UZZZ -c"select
consumer_id||consumer_id||consumer_id||consumer_id||consumer_id||consume
r_id||consumer_id||consumer_id from consumer" -o /dev/null
psql -dXXX -hYYY -UZZZ -o /dev/null  0.18s user 0.04s system 20% cpu
1.061 total



> -----Original Message-----
> From: pgsql-performance-owner@postgresql.org
> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Tom Darci
> Sent: Wednesday, October 25, 2006 10:21 AM
> To: pgsql-performance@postgresql.org
> Subject: [PERFORM] query slows down drastically with
> increased number of fields
>
> Hello All-
>
>   We have a question about numbers of fields in the select
> clause of a query and how that affects query speed.
>   The following query simply selects the primary key field
> from a table with 100,000 records:
>
> ------------------------------------------------------------
> select p.opid
> FROM
> ott_op p
>
> ------------------------------------------------------------
>
>   It runs in about half a second (running in PgAdmin... the
> query run time, not the data retrieval time)
>
>   When we change it by adding fields to the select list, it
> slows down drastically. This version takes about 3 seconds:
>
> ------------------------------------------------------------
> select p.opid, p.opid, p.opid, p.opid, p.opid, p.opid,
> p.opid, p.opid, p.opid, p.opid, p.opid
> FROM
> ott_op p
>
> ------------------------------------------------------------
>
>   The more fields we add, the slower it gets.
>
>   My guess is that we are missing a configuration setting...
> any ideas?
>   Any help much appreciated.
>
> Thanks,
> -Tom
>

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

Предыдущее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: VACUUMs take twice as long across all nodes
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: VACUUMs take twice as long across all nodes