GIN: any ordering guarantees for the hits returned?

Поиск
Список
Период
Сортировка
От adrobj
Тема GIN: any ordering guarantees for the hits returned?
Дата
Msg-id 13805836.post@talk.nabble.com
обсуждение исходный текст
Ответы Re: GIN: any ordering guarantees for the hits returned?
Список pgsql-general
Hello,

I have a moderately large (~10-20GB) table:

CREATE TABLE msgs (
  msg varchar(2048),
  msg_tsv tsvector,
  posted timestamp
);

CREATE INDEX msgs_i ON msgs USING gin(msg_tsv);

The table never gets updated (more specifically, it gets re-created once a
day with no updates in between).

I want to run queries of the following form:

SELECT msg, posted FROM msgs WHERE 'blah blah'::tsquery @@ msg_tsv ORDERED
BY posted DESC;
(with various LIMIT/OFFSET)

Which obviously may get too expensive, for it will cause reading and sorting
of all rows meeting the condition, i.e. too many disk reads.

On the other hand, (as far as I understand) GIN always produces hits already
sorted in the insertion order.

So - what if I just populate my table in the order of decreasing 'posted',
remove the "ORDERED BY" clause and just hope for the best? Will the correct
ordering be guaranteed?

If not, are there any other ideas around?

Thanks,
- adrobj
--
View this message in context:
http://www.nabble.com/GIN%3A-any-ordering-guarantees-for-the-hits-returned--tf4825287.html#a13805836
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


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

Предыдущее
От: Tom Hart
Дата:
Сообщение: Re: Tom thinks it's bad code was 8.3 vs 8.2 sql compatibility issue
Следующее
От: xeb@mail.ru
Дата:
Сообщение: ERROR: invalid restriction selectivity: 224359728.000000