Re: [PERFORM] index fragmentation on insert-only table with non-unique column

2016-05-24 Thread Jeff Janes
On Tue, May 24, 2016 at 10:39 AM, Justin Pryzby wrote: > Summary: Non-unique btree indices are returning CTIDs for rows with same > value of indexed column not in logical order, imposing a high performance > penalty. > > Running PG 9.5.3 now, we have a time-based partitions of append-only tables >

Re: [PERFORM] index fragmentation on insert-only table with non-unique column

2016-05-24 Thread Peter Geoghegan
On Tue, May 24, 2016 at 9:43 PM, Tom Lane wrote: > Yeah. I wonder what would happen if we used the same rule for index > insertions. It would likely make insertions more expensive, but maybe > not by much. The existing "randomization" rule for where to insert new > items in a run of identical i

Re: [PERFORM] index fragmentation on insert-only table with non-unique column

2016-05-24 Thread Tom Lane
Peter Geoghegan writes: > The basic problem is that the B-Tree code doesn't maintain this > property. However, B-Tree index builds will create an index that > initially has this property, because the tuplesort.c code happens to > sort index tuples with a CTID tie-breaker. Yeah. I wonder what wou

Re: [PERFORM] index fragmentation on insert-only table with non-unique column

2016-05-24 Thread Stephen Frost
* Peter Geoghegan (p...@bowt.ie) wrote: > On Tue, May 24, 2016 at 10:39 AM, Justin Pryzby wrote: > > I was able to see great improvement without planner parameters by REINDEX > > the > > timestamp index. My theory is that the index/planner doesn't handle well > > the > > case of many tuples wit

Re: [PERFORM] index fragmentation on insert-only table with non-unique column

2016-05-24 Thread Peter Geoghegan
On Tue, May 24, 2016 at 10:39 AM, Justin Pryzby wrote: > I was able to see great improvement without planner parameters by REINDEX the > timestamp index. My theory is that the index/planner doesn't handle well the > case of many tuples with same column value, and returns pages out of logical > or

[PERFORM] index fragmentation on insert-only table with non-unique column

2016-05-24 Thread Justin Pryzby
Summary: Non-unique btree indices are returning CTIDs for rows with same value of indexed column not in logical order, imposing a high performance penalty. Running PG 9.5.3 now, we have a time-based partitions of append-only tables with data loaded from other sources. The tables are partitioned b