Re: tstzrange on large table gives poor estimate of expected rows

2022-01-25 Thread Tom Dearman
Thanks for your help. It is true we could get rid of it but we still want to use the functional index on the date range as we understand it is supposed to be a better look up - we also have other date range look ups on tables that seem to be degrading. I have found a solution to the problem. The

Re: tstzrange on large table gives poor estimate of expected rows

2022-01-24 Thread Michael Lewis
If interval_end_date is always 1 day ahead, why store it at all? Dependencies on a custom stats object wouldn't do anything I don't think because they are offset. They are 100% correlated, but not in a way that any of the existing stat types capture as far as I can figure.

tstzrange on large table gives poor estimate of expected rows

2022-01-24 Thread Tom Dearman
Hi, We have a fairly big table (22 million rows) which has a start and end timestamp with time zone and other columns. Some of the columns plus start timestamp make a primary key. The end timestamp is exactly one day ahead of the start timestamp for each row and there are approximately 1 row