Re: Work table

Поиск
Список
Период
Сортировка
От Bill Moran
Тема Re: Work table
Дата
Msg-id 20131028234546.05c8efa8695e30a9556c50b9@potentialtech.com
обсуждение исходный текст
Ответ на Re: Work table  (Robert James <srobertjames@gmail.com>)
Список pgsql-general
On Mon, 28 Oct 2013 15:50:42 -0400 Robert James <srobertjames@gmail.com> wrote:

> It could be > 1 Million rows.
>
> SELECT is:
>
> SELECT *
>     FROM another_table
>     WHERE
>         eventtime > (SELECT e FROM tags WHERE id = $1) AND
>         eventtime < (SELECT e FROM tags WHERE id = $2)
> ;
>
> $1 and $2 are integers.
>
> SELECT ran just now, returning >1Million rows, in 1.6 seconds.
>
> Inserting into work table causes weird behavior - it takes over a
> minute, PG CPU climbs to 100%, but then other subsequent queries
> sometimes seem to slow down too.  After a lot of these, sometimes PG
> acts irresponsive until I restart it.

Depending on the nature of your hardware, this might not be weird ...

For example, if you have enough RAM that all of another_table fits
in RAM, and (comparitively) slow disks, the SELECT would run
considerably faster than an insert of the same size.

--
Bill Moran <wmoran@potentialtech.com>


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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Cursor Example Needed
Следующее
От: Matt
Дата:
Сообщение: INSERT/UPDATE statements sometimes choosing not to use PK index?