9 Commits

Author SHA1 Message Date
Matvey Arye
c43307387e Add runtime exclusion for hypertables
In some cases, entire hypertables can be excluded
at runtime. Some Examples:

   WHERE col @> ANY(subselect)
   if the subselect returns empty set

   WHERE col op (subselect)
   if the op is a strict operator and
   the subselect returns empty set.

When qual clauses are not on partition columns, we use
the old chunk exclusion, otherwise we try hypertable exclusion.

Hypertable exclusion is executed once per hypertable.
This is cheaper than the chunk  exclusion
that is once-per-chunk.
2022-08-25 13:17:21 -04:00
Konstantina Skovola
f059e00fad Create composite index on segmentby columns
Previously we created one index per segmentby column, of the form
`(col, _ts_meta_sequence_num)`.
Compressed data is ordered by segmentby, then by orderby within
the segments and lastly by the sequence number of the batch. So if
segmentby columns are missing from the index, that index cannot be
used to produce ordered output, requiring an extra sort step.

A composite index containing all segmentby columns removes the
additional sort step and gives better plans.

Fixes #4314
2022-06-03 11:41:01 +03:00
Sven Klemm
a759b2b2b9 Show number of chunks excluded in ConstraintAwareAppend EXPLAIN
This patch changes the ConstraintAwareAppend EXPLAIN output to show
the number of chunks excluded instead of the number of chunks left.
The number of chunks left can be seen from other EXPLAIN output
while the actual number of exclusions that happened can not. This
also makes the output consistent with output of ChunkAppend.
2022-03-17 17:46:01 +01:00
Sven Klemm
4d425d9470 Disable memoize node for append and transparent_decompression tests
With memoize enabled PG14 append tests produce a very different
plan compared to previous PG versions. To make comparing plans
between PG versions easier we disable memoize for PG14.
PG14 also modified how EXTRACT is shown in EXPLAIN output
so any query using EXTRACT will have different EXPLAIN output
between PG14 and previous versions.
2021-10-09 00:15:23 +02:00
gayyappan
318d2fd808 Remove paths that reference parent relids for compressed chunks
We explicilty filter paths for compressed chunks that
have spurious join clauses between the compressed chunk and
the original chunk or hypertable. However there are other
cases where a chunk could be a child rel
(i.e. RELOPT_OTHER_MEMBER_REL) such as when the chunk is
referenced as part of a UNION ALL query. We remove all
paths that have spurious join clauses between the compressed
chunk and any implied parent for the chunk.

Fixes #2917
2021-06-10 15:27:03 -04:00
Sven Klemm
cc38ba3241 Keep Append pathkeys in ChunkAppend
This changes ChunkAppend to always keep the pathkeys from the original
path because the original path was either a MergeAppendPath and this
will become an ordered append or the original path is an AppendPath
and since we do not reorder children the order will be kept intact.
For the AppendPath case with pathkeys it was most likely an Append
with only a single child. We could skip the ChunkAppend path creation
if there is only a single child but we decided earlier that ChunkAppend
would be beneficial for this query so we treat it the same as if it
had multiple children.

Fixes #3030
2021-04-06 12:23:42 +02:00
gayyappan
87a190afcd Fix nested loop joins for compressed chunk
This change adds equivalence class members for non segment
by attributes of compressed tables. Before the change
introduced by this PR, we added equivalence members to the
compressed chunk only for segment by columns. If we
have a join condition like:
hyper.segment_col = A.col1 and hyper.compressed_attr = A.col2
The compressed rel had EM only for
compressed_chunk.segment_col = A.col1

When a parameterized path is created for the compressed chunk,
it has only 1 clause (corresponding to the segment by EM )
in its list of ppi_clauses. The other clause is missing since
it did not have an EM. A parameterized path is expected to carry
all the clauses that come from the outer_rel for the join
(table A in this case).Since the ppi_clauses did not have all
the clauses that come from table A, we ended up missing a join
condition (for table A) when we had a parameterized index path
for the compressed chunk.

Fixes #2673
2021-01-27 14:06:16 -05:00
Mats Kindahl
02ad8b4e7e Turn debug messages into DEBUG1
We have some debug messages that are printed as notices, but are more
suitable to have at `DEBUG1` level. This commit removes a notice about
indexes being added and turns it into a `DEBUG1` notice.
2020-09-29 11:04:07 +02:00
Sven Klemm
0c1f967ef8 Refactor transparent_decompression test
This PR reduces the dataset size in the transparent_decompression
test to make it finish in a more reasonable time. It also splits
the test and modifies queries that used now(). Due to the change
in dataset size the resulting diff is rather large but is mostly
row count changes in the plan but the actual plan shapes don't
change. In addition to those changes to some LATERAL queries
additional constraints have been added to reduce the number of
loops.
2020-06-25 18:42:54 +02:00