Re: Why Postgres doesn't use TID scan?

Поиск
Список
Период
Сортировка
От Vladimir Ryabtsev
Тема Re: Why Postgres doesn't use TID scan?
Дата
Msg-id CAMqTPq=Pu=gS6bg2BqvZU5D=Vj4Ef1qC8wvNDEbmoMUQ7T_m6A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Why Postgres doesn't use TID scan?  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Ответы Re: Why Postgres doesn't use TID scan?
Список pgsql-performance
> The workaround is to do it like this instead:

Strange, I tried to do like this, but the first thing came into my mind was array_agg() not array():

delete from log
where ctid = any(
    select array_agg(ctid) from (
        select ctid from log
        where timestamp < now() at time zone 'pst' - interval '2 month'
        limit 10
    ) v);

This query complained like this:

ERROR: operator does not exist: tid = tid[]
LINE 2: where ctid = any(
                   ^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

Which is strange because both array(select ...) and select array_agg() ... return the same datatype ctid[].

> But of course that's still an ugly hack.

Come on... Due to declarative nature of SQL developers sometimes need to write much dirtier and uglier hacks.
This one is just a fluffy hacky.

--
Vlad

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

Предыдущее
От: Andrew Gierth
Дата:
Сообщение: Re: Why Postgres doesn't use TID scan?
Следующее
От: Andrew Gierth
Дата:
Сообщение: Re: Why Postgres doesn't use TID scan?