From: | Michael Lewis <mlewis(at)entrata(dot)com> |
---|---|
To: | Jeremy Finzel <finzelj(at)gmail(dot)com> |
Cc: | David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: BRIN index which is much faster never chosen by planner |
Date: | 2019-10-15 16:43:50 |
Message-ID: | CAHOFxGq7AQuMALi-ZH+4sRLKfLJ2-KzXRu3WVwM1fZzzhtCBpA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
>
From | Date | Subject | |
---|---|---|---|
Next Message | vignesh C | 2019-10-15 17:27:02 | Re: Ordering of header file inclusion |
Previous Message | Justin Pryzby | 2019-10-15 16:40:47 | v12.0: interrupt reindex CONCURRENTLY: ccold: ERROR: could not find tuple for parent of relation ... |