8 Commits

Author SHA1 Message Date
Sven Klemm
302de38b7e Fix projection in ChunkAppend nodes
When the targetlist of a ChunkAppend node was modified after plan
creation the ChunkAppend node would not properly project because
input and output targetlist where pointing to the same list, so
any modification to the output targetlist would carry over to the
input targetlist. This patch decouples input targetlist from
output targetlist to prevent this from happening.
2021-01-25 18:48:01 +01:00
Sven Klemm
9b3d2e6d52 Add explicit ORDER BY to append test data generation
The queries to produce test data for space partitioned
hypertables in the append test did not have an explicit
ORDER BY clause leading to a different ordering for the
chunks created on PG12.
2020-03-25 02:19:39 +01:00
Matvey Arye
599a877854 Fix constify params during runtime exclusion
Descending into subplans during constification of params
seems unsafe and has led to bugs. Turning this off seems
to be safe and not regress any tested optimizations.

In the future we may want to find a way to optimize this
case as well.

Fixes #1598.
2020-01-07 14:55:02 -05:00
Sven Klemm
38b0c538e3 Fix append test flakyness
Some of the append test queries relied on ANALYZE not having run yet
to produce the desired plan. This patch changes the test to
generate more test data and runs ANALYZE explicitly so the tests
are reproducible.
2019-09-18 17:39:38 +02:00
Sven Klemm
7c434d4914 Fix ChunkAppend space partitioning support for ordered append
When ordered append tried to push down targetlist to child paths
it assumed childs would be scans on rels which is not true for
space partitioning where children might be MergeAppend nodes.
This patch also no longer applies the ordered append optimization
to partial paths because its not safe to do so.
This patch also adds more tests for space partitioned hypertables.
2019-08-21 23:08:15 +02:00
Sven Klemm
3737a6bc16 Fix ConstraintAwareAppend subquery exclusion
The RangeTblEntry index used during planning might be different from
the index used during execution due to flattening. This patch changes
ConstraintAwareAppend to handle queries where the index changed between
planning and execution.
2019-07-22 18:21:28 +02:00
Sven Klemm
70ffb1b2e6 Add support for cross datatype chunk exclusion for time types
Cross datatype comparisons between DATE/TIMESTAMP/TIMESTAMPTZ
are not immutable which prevents their usage for chunk exclusion.
Unfortunately estimate_expression_value will not estimate those
expressions which makes them unusable for execution time chunk
exclusion with constraint aware append.
To circumvent this we inject casts and use an operator
with the same datatype on both sides when constifying the
restrictinfo. This allows estimate_expression_value
to evaluate those expressions and makes them accessible for
execution time chunk exclusion.

The following transformations are done:
TIMESTAMP OP TIMESTAMPTZ => TIMESTAMP OP (TIMESTAMPTZ::TIMESTAMP)
TIMESTAMPTZ OP DATE => TIMESTAMPTZ OP (DATE::TIMESTAMPTZ)

No transformation is required for TIMESTAMP OP DATE because
those operators are marked immutable.
2019-04-03 21:00:34 +02:00
Sven Klemm
0b4dcba72d Refactor append test
Change append test to merge append plan output and result test
similar to make them similar to other tests.
2019-03-24 22:30:31 +01:00