Re: BRIN index which is much faster never chosen by planner

Поиск
Список
Период
Сортировка
От Michael Lewis
Тема Re: BRIN index which is much faster never chosen by planner
Дата
Msg-id CAHOFxGq7AQuMALi-ZH+4sRLKfLJ2-KzXRu3WVwM1fZzzhtCBpA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BRIN index which is much faster never chosen by planner  (Jeremy Finzel <finzelj@gmail.com>)
Ответы Re: BRIN index which is much faster never chosen by planner
Список pgsql-hackers
Thanks for closing the loop on the data correlation question. I've been playing with BRIN indexes on a log table of sorts and this thread helped clear up some of the behavior I have been seeing.

I am curious, would a partial btree index fit your needs? Perhaps the maintenance overhead is too significant or this is too off-the-wall, but a daily job to create new index and drop the old concurrently could give the performance you need while still saving the extra disk space of the full btree on the timestamp.

CREATE INDEX CONCURRENTLY log_table_rec_insert_time_partial_10_04 ON log_table USING btree ( rec_insert_time ) WHERE rec_insert_time > '2019-10-04'::DATE;
DROP INDEX CONCURRENTLY IF EXISTS log_table_rec_insert_time_partial_10_03;

I would consider including category column as well, but I suspect that would increase the size of the index significantly. Of course, this depends on the query planner evaluating that "l.rec_insert_time >= now() - interval '10 days'" and determining that the index fulfills the need.

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

Предыдущее
От: Justin Pryzby
Дата:
Сообщение: v12.0: interrupt reindex CONCURRENTLY: ccold: ERROR: could not findtuple for parent of relation ...
Следующее
От: vignesh C
Дата:
Сообщение: Re: Ordering of header file inclusion