AW: [INTERFACES] Re: [HACKERS] changes in 6.4

Поиск
Список
Период
Сортировка
От Andreas Zeugswetter
Тема AW: [INTERFACES] Re: [HACKERS] changes in 6.4
Дата
Msg-id 01BDD4DA.C7F5B690@zeugswettera.user.lan.at
обсуждение исходный текст
Список pgsql-hackers
>Another idea would be to do actual UNION queries:
>
>    SELECT * FROM tab
>    WHERE (x=3 and y=4)
>    UNION
>    SELECT * FROM tab
>    WHERE (x=3 and y=5)
>    UNION
>    SELECT * FROM tab
>    WHERE (x=3 and y=6) ...
>
>This would work well for tables with indexes, but for a sequential scan,
>you are doing a sequential scan for each UNION.

The most important Application for this syntax will be M$ Access
because it uses this syntax to display x rows from a table in a particular
sort order. In this case x and y will be the primary key and therefore have a
unique index. So I think this special case should work good.

The strategy could be something like:
iff x, y is a unique index
    do the union access path
else
    do something else
done

I think hand written SQL can always be rewritten if it is not fast enough
using this syntax.

Andreas


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

Предыдущее
От: Michael Meskes
Дата:
Сообщение: Strange NOTICE
Следующее
От: korapat
Дата:
Сообщение: UNION opration NOT return all result set :) pls help