More efficient INs when comparing two columns

Поиск
Список
Период
Сортировка
От Magnus Naeslund(t)
Тема More efficient INs when comparing two columns
Дата
Msg-id 433058C1.1010609@fbab.net
обсуждение исходный текст
Ответы Re: More efficient INs when comparing two columns  (Roman Neuhauser <neuhauser@sigpipe.cz>)
Список pgsql-general
I was thinking if this was possible in some way..
I have this table where we have X and Y coordinates, and i need to
select several in one go.

# select * from xy where (x = 1 and y = 2) or (x = 2 and y = 2);

This works but are not so nice looking.
It would be nice to be able to do it like this:

# select * from xy where (x, y) in ((1, 2), (2, 2));

But that doesn't work.
A funny thing is that this works:

# select * from xy where (x, y) = (1, 2);

What's the most efficient way of doing these kind of selects?
A multicol index on x and y is what we currently do and the first select
above...

Regards,
Magnus


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

Предыдущее
От: "Dean Gibson (DB Administrator)"
Дата:
Сообщение: Re: running vacuum in scripts
Следующее
От: "Brandon Metcalf"
Дата:
Сообщение: pg_autovacuum not sleeping