You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by ma...@apache.org on 2025/02/18 05:39:51 UTC
(cloudberry) 12/31: Add support for min/max aggregates optimization (#16480)
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 0dafcea5da000fcd4f63c469816fa46dffb6f0e5
Author: Sanath Kumar Vobilisetty <sa...@gmail.com>
AuthorDate: Thu Oct 26 13:11:57 2023 -0400
Add support for min/max aggregates optimization (#16480)
* Add support for min/max aggregates optimization
This commit adds support for min(), max() aggregates optimization, going
forward ORCA uses IndexScans(Forward/Backward) along with a limit operator to
perform min(), max() on a btree index key. Prior to this commit, ORCA uses
regular aggregates with Sequential Scan to accomplish this. Along with this
optimization, this commit also adds support for IS NULL and IS NOT NULL
conditions on a btree index column and uses an Index Scan for such predicates
instead of a Sequential Scan. This support was required(at least for IS NOT
NULL condition) in order to proceed with min/max optimization. New plan changes
are quite straightforward with an IndexScan and a Limit operator instead of
aggregate with sequential scan. Leveraging index scans with limit could improve
the query performance significantly.
---
.../gpopt/translate/CTranslatorDXLToPlStmt.cpp | 149 ++-
.../data/dxl/minidump/IndexScan-IsNotNullPred.mdp | 299 +++++
.../data/dxl/minidump/IndexScan-IsNullPred.mdp | 297 +++++
.../Max-Aggregate-uses-IndexScan-and-Limit.mdp | 1195 +++++++++++++++++++
.../Min-Aggregate-uses-IndexScan-and-Limit.mdp | 1199 ++++++++++++++++++++
.../gporca/libgpopt/include/gpopt/base/CUtils.h | 9 +
.../gpopt/operators/CScalarProjectElement.h | 4 +
.../gporca/libgpopt/include/gpopt/xforms/CXform.h | 1 +
.../include/gpopt/xforms/CXformMinMax2IndexGet.h | 87 ++
.../libgpopt/include/gpopt/xforms/CXformUtils.h | 41 +-
.../gporca/libgpopt/include/gpopt/xforms/xforms.h | 1 +
src/backend/gporca/libgpopt/src/base/CUtils.cpp | 29 +
.../libgpopt/src/metadata/CTableDescriptor.cpp | 2 +-
.../gporca/libgpopt/src/operators/CLogical.cpp | 44 +-
.../libgpopt/src/operators/CLogicalGbAgg.cpp | 1 +
.../libgpopt/src/operators/CPredicateUtils.cpp | 20 +-
.../gporca/libgpopt/src/xforms/CXformFactory.cpp | 1 +
.../libgpopt/src/xforms/CXformJoin2IndexApply.cpp | 6 +-
.../libgpopt/src/xforms/CXformLimit2IndexGet.cpp | 6 +-
.../libgpopt/src/xforms/CXformMinMax2IndexGet.cpp | 314 +++++
.../src/xforms/CXformSelect2DynamicIndexGet.cpp | 10 +-
.../libgpopt/src/xforms/CXformSelect2IndexGet.cpp | 4 +-
.../gporca/libgpopt/src/xforms/CXformUtils.cpp | 60 +
src/backend/gporca/libgpopt/src/xforms/Makefile | 1 +
src/backend/gporca/server/CMakeLists.txt | 3 +-
src/include/gpopt/translate/CIndexQualInfo.h | 3 +-
src/test/regress/expected/aggregates_optimizer.out | 102 +-
src/test/regress/expected/dpe.out | 15 +
src/test/regress/expected/dpe_optimizer.out | 15 +
.../regress/expected/groupingsets_optimizer.out | 19 +-
src/test/regress/expected/join_gp_optimizer.out | 6 +-
.../regress/expected/partition_prune_optimizer.out | 13 +-
src/test/regress/expected/qp_indexscan.out | 794 +++++++++++++
.../regress/expected/qp_indexscan_optimizer.out | 796 ++++++++++++-
src/test/regress/sql/dpe.sql | 5 +
src/test/regress/sql/qp_indexscan.sql | 268 ++++-
36 files changed, 5628 insertions(+), 191 deletions(-)
diff --git a/src/backend/gpopt/translate/CTranslatorDXLToPlStmt.cpp b/src/backend/gpopt/translate/CTranslatorDXLToPlStmt.cpp
index 6d914ac3ab..5f988418af 100644
--- a/src/backend/gpopt/translate/CTranslatorDXLToPlStmt.cpp
+++ b/src/backend/gpopt/translate/CTranslatorDXLToPlStmt.cpp
@@ -91,6 +91,7 @@ extern "C" {
#include "naucrates/dxl/operators/CDXLScalarBoolExpr.h"
#include "naucrates/dxl/operators/CDXLScalarFuncExpr.h"
#include "naucrates/dxl/operators/CDXLScalarHashExpr.h"
+#include "naucrates/dxl/operators/CDXLScalarNullTest.h"
#include "naucrates/dxl/operators/CDXLScalarOpExpr.h"
#include "naucrates/dxl/operators/CDXLScalarProjElem.h"
#include "naucrates/dxl/operators/CDXLScalarSortCol.h"
@@ -1107,16 +1108,45 @@ CTranslatorDXLToPlStmt::TranslateIndexConditions(
for (ULONG ul = 0; ul < arity; ul++)
{
CDXLNode *index_cond_dxlnode = (*index_cond_list_dxlnode)[ul];
-
+ CDXLNode *modified_null_test_cond_dxlnode = nullptr;
+
+ // FIXME: Remove this translation from BoolExpr to NullTest when ORCA gets rid of
+ // translation of 'x IS NOT NULL' to 'NOT (x IS NULL)'. Here's the ticket that tracks
+ // the issue: https://github.com/greenplum-db/gpdb/issues/16294
+
+ // Translate index condition CDXLScalarBoolExpr of format 'NOT (col IS NULL)'
+ // to CDXLScalarNullTest 'col IS NOT NULL', because IndexScan only
+ // supports indexquals of types: OpExpr, RowCompareExpr,
+ // ScalarArrayOpExpr and NullTest
+ if (index_cond_dxlnode->GetOperator()->GetDXLOperator() ==
+ EdxlopScalarBoolExpr)
+ {
+ CDXLScalarBoolExpr *boolexpr_dxlop =
+ CDXLScalarBoolExpr::Cast(index_cond_dxlnode->GetOperator());
+ if (boolexpr_dxlop->GetDxlBoolTypeStr() == Edxlnot &&
+ (*index_cond_dxlnode)[0]->GetOperator()->GetDXLOperator() ==
+ EdxlopScalarNullTest)
+ {
+ CDXLNode *null_test_cond_dxlnode = (*index_cond_dxlnode)[0];
+ CDXLNode *scalar_ident_dxlnode = (*null_test_cond_dxlnode)[0];
+ scalar_ident_dxlnode->AddRef();
+ modified_null_test_cond_dxlnode = GPOS_NEW(m_mp) CDXLNode(
+ m_mp, GPOS_NEW(m_mp) CDXLScalarNullTest(m_mp, false),
+ scalar_ident_dxlnode);
+ index_cond_dxlnode = modified_null_test_cond_dxlnode;
+ }
+ }
Expr *original_index_cond_expr =
m_translator_dxl_to_scalar->TranslateDXLToScalar(
index_cond_dxlnode, &colid_var_mapping);
Expr *index_cond_expr =
m_translator_dxl_to_scalar->TranslateDXLToScalar(
index_cond_dxlnode, &colid_var_mapping);
- GPOS_ASSERT((IsA(index_cond_expr, OpExpr) ||
- IsA(index_cond_expr, ScalarArrayOpExpr)) &&
- "expected OpExpr or ScalarArrayOpExpr in index qual");
+ GPOS_ASSERT(
+ (IsA(index_cond_expr, OpExpr) ||
+ IsA(index_cond_expr, ScalarArrayOpExpr) ||
+ IsA(index_cond_expr, NullTest)) &&
+ "expected OpExpr or ScalarArrayOpExpr or NullTest in index qual");
// allow Index quals with scalar array only for bitmap and btree indexes
if (!is_bitmap_index_probe && IsA(index_cond_expr, ScalarArrayOpExpr) &&
@@ -1138,39 +1168,58 @@ CTranslatorDXLToPlStmt::TranslateIndexConditions(
{
args_list = ((OpExpr *) index_cond_expr)->args;
}
- else
+ else if (IsA(index_cond_expr, ScalarArrayOpExpr))
{
args_list = ((ScalarArrayOpExpr *) index_cond_expr)->args;
}
-
- Node *left_arg = (Node *) lfirst(gpdb::ListHead(args_list));
- Node *right_arg = (Node *) lfirst(gpdb::ListTail(args_list));
-
- BOOL is_relabel_type = false;
- if (IsA(left_arg, RelabelType) &&
- IsA(((RelabelType *) left_arg)->arg, Var))
+ else
{
- left_arg = (Node *) ((RelabelType *) left_arg)->arg;
- is_relabel_type = true;
+ // NullTest struct doesn't have List argument, hence ignoring
+ // assignment for that type
}
- else if (IsA(right_arg, RelabelType) &&
- IsA(((RelabelType *) right_arg)->arg, Var))
+
+ Node *left_arg;
+ Node *right_arg;
+ bool is_null_test_type = false;
+ if (IsA(index_cond_expr, NullTest))
{
- right_arg = (Node *) ((RelabelType *) right_arg)->arg;
- is_relabel_type = true;
+ // NullTest only has one arg
+ left_arg = (Node *) (((NullTest *) index_cond_expr)->arg);
+ is_null_test_type = true;
}
-
- if (is_relabel_type)
+ else
{
- List *new_args_list = ListMake2(left_arg, right_arg);
- gpdb::GPDBFree(args_list);
- if (IsA(index_cond_expr, OpExpr))
+ left_arg = (Node *) lfirst(gpdb::ListHead(args_list));
+ right_arg = (Node *) lfirst(gpdb::ListTail(args_list));
+ // Type Coercion doesn't add much value for IS NULL and IS NOT NULL
+ // conditions, and is not supported by ORCA currently
+ BOOL is_relabel_type = false;
+ if (IsA(left_arg, RelabelType) &&
+ IsA(((RelabelType *) left_arg)->arg, Var))
{
- ((OpExpr *) index_cond_expr)->args = new_args_list;
+ left_arg = (Node *) ((RelabelType *) left_arg)->arg;
+ is_relabel_type = true;
}
- else
+ else if (IsA(right_arg, RelabelType) &&
+ IsA(((RelabelType *) right_arg)->arg, Var))
{
- ((ScalarArrayOpExpr *) index_cond_expr)->args = new_args_list;
+ right_arg = (Node *) ((RelabelType *) right_arg)->arg;
+ is_relabel_type = true;
+ }
+
+ if (is_relabel_type)
+ {
+ List *new_args_list = ListMake2(left_arg, right_arg);
+ gpdb::GPDBFree(args_list);
+ if (IsA(index_cond_expr, OpExpr))
+ {
+ ((OpExpr *) index_cond_expr)->args = new_args_list;
+ }
+ else
+ {
+ ((ScalarArrayOpExpr *) index_cond_expr)->args =
+ new_args_list;
+ }
}
}
@@ -1197,23 +1246,37 @@ CTranslatorDXLToPlStmt::TranslateIndexConditions(
attno = ((Var *) right_arg)->varattno;
}
- // retrieve index strategy and subtype
- StrategyNumber strategy_num;
- OID index_subtype_oid = InvalidOid;
-
- OID cmp_operator_oid =
- CTranslatorUtils::OidCmpOperator(index_cond_expr);
- GPOS_ASSERT(InvalidOid != cmp_operator_oid);
- OID op_family_oid = CTranslatorUtils::GetOpFamilyForIndexQual(
- attno, CMDIdGPDB::CastMdid(index->MDId())->Oid());
- GPOS_ASSERT(InvalidOid != op_family_oid);
- gpdb::IndexOpProperties(cmp_operator_oid, op_family_oid, &strategy_num,
- &index_subtype_oid);
-
- // create index qual
- index_qual_info_array->Append(GPOS_NEW(m_mp) CIndexQualInfo(
- attno, index_cond_expr, original_index_cond_expr, strategy_num,
- index_subtype_oid));
+ // NullTest indexqual doesn't need strategy or subtype
+ if (is_null_test_type)
+ {
+ index_qual_info_array->Append(GPOS_NEW(m_mp) CIndexQualInfo(
+ attno, index_cond_expr, original_index_cond_expr,
+ InvalidStrategy, InvalidOid));
+ }
+ else
+ {
+ // retrieve index strategy and subtype
+ StrategyNumber strategy_num;
+ OID index_subtype_oid = InvalidOid;
+
+ OID cmp_operator_oid =
+ CTranslatorUtils::OidCmpOperator(index_cond_expr);
+ GPOS_ASSERT(InvalidOid != cmp_operator_oid);
+ OID op_family_oid = CTranslatorUtils::GetOpFamilyForIndexQual(
+ attno, CMDIdGPDB::CastMdid(index->MDId())->Oid());
+ GPOS_ASSERT(InvalidOid != op_family_oid);
+ gpdb::IndexOpProperties(cmp_operator_oid, op_family_oid,
+ &strategy_num, &index_subtype_oid);
+
+ // create index qual
+ index_qual_info_array->Append(GPOS_NEW(m_mp) CIndexQualInfo(
+ attno, index_cond_expr, original_index_cond_expr, strategy_num,
+ index_subtype_oid));
+ }
+ if (modified_null_test_cond_dxlnode != nullptr)
+ {
+ modified_null_test_cond_dxlnode->Release();
+ }
}
// the index quals much be ordered by attribute number
diff --git a/src/backend/gporca/data/dxl/minidump/IndexScan-IsNotNullPred.mdp b/src/backend/gporca/data/dxl/minidump/IndexScan-IsNotNullPred.mdp
new file mode 100644
index 0000000000..60d912766c
--- /dev/null
+++ b/src/backend/gporca/data/dxl/minidump/IndexScan-IsNotNullPred.mdp
@@ -0,0 +1,299 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<dxl:DXLMessage xmlns:dxl="http://greenplum.com/dxl/2010/12/">
+<dxl:Comment><![CDATA[
+
+ Objective of this test is to ensure IsNotNull predicates on btree indices use IndexScan
+
+ create table index_scan_null_test_preds(a int, b float, c text);
+ create index idx_b on index_scan_null_test_preds using btree(b);
+
+ Query: explain select * from index_scan_null_test_preds where b is not null;
+
+ Plan:
+ QUERY PLAN
+
+ Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..6.00 rows=1 width=20)
+ -> Index Scan using idx_b on index_scan_null_test_preds (cost=0.00..6.00 rows=1 width=20)
+ Index Cond: (b IS NOT NULL)
+ Optimizer: GPORCA
+ (4 rows)
+
+ ]]>
+ </dxl:Comment>
+ <dxl:Thread Id="0">
+ <dxl:OptimizerConfig>
+ <dxl:EnumeratorConfig Id="0" PlanSamples="0" CostThreshold="0"/>
+ <dxl:StatisticsConfig DampingFactorFilter="0.750000" DampingFactorJoin="0.000000" DampingFactorGroupBy="0.750000" MaxStatsBuckets="100"/>
+ <dxl:CTEConfig CTEInliningCutoff="0"/>
+ <dxl:WindowOids RowNumber="3100" Rank="3101"/>
+ <dxl:CostModelConfig CostModelType="1" SegmentsForCosting="3">
+ <dxl:CostParams>
+ <dxl:CostParam Name="NLJFactor" Value="1024.000000" LowerBound="1023.500000" UpperBound="1024.500000"/>
+ </dxl:CostParams>
+ </dxl:CostModelConfig>
+ <dxl:Hint JoinArityForAssociativityCommutativity="18" ArrayExpansionThreshold="20" JoinOrderDynamicProgThreshold="10" BroadcastThreshold="100000" EnforceConstraintsOnDML="false" PushGroupByBelowSetopThreshold="10" XformBindThreshold="0" SkewFactor="0"/>
+ <dxl:TraceFlags Value="102001,102002,102003,102043,102074,102120,102144,102162,102163,103001,103014,103022,103026,103027,103029,103033,103038,103040,104002,104003,104004,104005,105000,106000"/>
+ </dxl:OptimizerConfig>
+ <dxl:Metadata SystemIds="0.GPDB">
+ <dxl:Index Mdid="7.31038.1.0" Name="idx_b" IsClustered="false" AmCanOrder="true" IndexType="B-tree" IndexItemType="0.2283.1.0" KeyColumns="1" IncludedColumns="" ReturnableColumns="1" SortDirection="ASC" NullsDirection="LAST">
+ <dxl:Opfamilies>
+ <dxl:Opfamily Mdid="0.1970.1.0"/>
+ </dxl:Opfamilies>
+ </dxl:Index>
+ <dxl:RelationStatistics Mdid="2.31033.1.0" Name="index_scan_null_test_preds" Rows="0.000000" RelPages="0" RelAllVisible="0" EmptyRelation="true"/>
+ <dxl:Relation Mdid="6.31033.1.0" Name="index_scan_null_test_preds" IsTemporary="false" StorageType="Heap" DistributionPolicy="Hash" DistributionColumns="0" Keys="9,3">
+ <dxl:Columns>
+ <dxl:Column Name="a" Attno="1" Mdid="0.23.1.0" Nullable="true" ColWidth="4"/>
+ <dxl:Column Name="b" Attno="2" Mdid="0.701.1.0" Nullable="true" ColWidth="8"/>
+ <dxl:Column Name="c" Attno="3" Mdid="0.25.1.0" Nullable="true" ColWidth="8"/>
+ <dxl:Column Name="ctid" Attno="-1" Mdid="0.27.1.0" Nullable="false" ColWidth="6"/>
+ <dxl:Column Name="xmin" Attno="-2" Mdid="0.28.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="cmin" Attno="-3" Mdid="0.29.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="xmax" Attno="-4" Mdid="0.28.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="cmax" Attno="-5" Mdid="0.29.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="tableoid" Attno="-6" Mdid="0.26.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="gp_segment_id" Attno="-7" Mdid="0.23.1.0" Nullable="false" ColWidth="4"/>
+ </dxl:Columns>
+ <dxl:IndexInfoList>
+ <dxl:IndexInfo Mdid="7.31038.1.0" IsPartial="false"/>
+ </dxl:IndexInfoList>
+ <dxl:CheckConstraints/>
+ <dxl:DistrOpfamilies>
+ <dxl:DistrOpfamily Mdid="0.1977.1.0"/>
+ </dxl:DistrOpfamilies>
+ </dxl:Relation>
+ <dxl:Type Mdid="0.16.1.0" Name="bool" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="1" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.2222.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7124.1.0"/>
+ <dxl:PartOpfamily Mdid="0.424.1.0"/>
+ <dxl:EqualityOp Mdid="0.91.1.0"/>
+ <dxl:InequalityOp Mdid="0.85.1.0"/>
+ <dxl:LessThanOp Mdid="0.58.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.1694.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.59.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.1695.1.0"/>
+ <dxl:ComparisonOp Mdid="0.1693.1.0"/>
+ <dxl:ArrayType Mdid="0.1000.1.0"/>
+ <dxl:MinAgg Mdid="0.0.0.0"/>
+ <dxl:MaxAgg Mdid="0.0.0.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.23.1.0" Name="int4" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="4" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.1977.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7100.1.0"/>
+ <dxl:PartOpfamily Mdid="0.1976.1.0"/>
+ <dxl:EqualityOp Mdid="0.96.1.0"/>
+ <dxl:InequalityOp Mdid="0.518.1.0"/>
+ <dxl:LessThanOp Mdid="0.97.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.523.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.521.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.525.1.0"/>
+ <dxl:ComparisonOp Mdid="0.351.1.0"/>
+ <dxl:ArrayType Mdid="0.1007.1.0"/>
+ <dxl:MinAgg Mdid="0.2132.1.0"/>
+ <dxl:MaxAgg Mdid="0.2116.1.0"/>
+ <dxl:AvgAgg Mdid="0.2101.1.0"/>
+ <dxl:SumAgg Mdid="0.2108.1.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.25.1.0" Name="text" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="true" IsFixedLength="false" Length="-1" PassByValue="false">
+ <dxl:DistrOpfamily Mdid="0.1995.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7105.1.0"/>
+ <dxl:PartOpfamily Mdid="0.1994.1.0"/>
+ <dxl:EqualityOp Mdid="0.98.1.0"/>
+ <dxl:InequalityOp Mdid="0.531.1.0"/>
+ <dxl:LessThanOp Mdid="0.664.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.665.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.666.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.667.1.0"/>
+ <dxl:ComparisonOp Mdid="0.360.1.0"/>
+ <dxl:ArrayType Mdid="0.1009.1.0"/>
+ <dxl:MinAgg Mdid="0.2145.1.0"/>
+ <dxl:MaxAgg Mdid="0.2129.1.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.26.1.0" Name="oid" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="4" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.1990.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7109.1.0"/>
+ <dxl:PartOpfamily Mdid="0.1989.1.0"/>
+ <dxl:EqualityOp Mdid="0.607.1.0"/>
+ <dxl:InequalityOp Mdid="0.608.1.0"/>
+ <dxl:LessThanOp Mdid="0.609.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.611.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.610.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.612.1.0"/>
+ <dxl:ComparisonOp Mdid="0.356.1.0"/>
+ <dxl:ArrayType Mdid="0.1028.1.0"/>
+ <dxl:MinAgg Mdid="0.2134.1.0"/>
+ <dxl:MaxAgg Mdid="0.2118.1.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.27.1.0" Name="tid" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="6" PassByValue="false">
+ <dxl:DistrOpfamily Mdid="0.2227.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7110.1.0"/>
+ <dxl:PartOpfamily Mdid="0.2789.1.0"/>
+ <dxl:EqualityOp Mdid="0.387.1.0"/>
+ <dxl:InequalityOp Mdid="0.402.1.0"/>
+ <dxl:LessThanOp Mdid="0.2799.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.2801.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.2800.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.2802.1.0"/>
+ <dxl:ComparisonOp Mdid="0.2794.1.0"/>
+ <dxl:ArrayType Mdid="0.1010.1.0"/>
+ <dxl:MinAgg Mdid="0.2798.1.0"/>
+ <dxl:MaxAgg Mdid="0.2797.1.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.29.1.0" Name="cid" IsRedistributable="true" IsHashable="true" IsMergeJoinable="false" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="4" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.2226.1.0"/>
+ <dxl:EqualityOp Mdid="0.385.1.0"/>
+ <dxl:InequalityOp Mdid="0.0.0.0"/>
+ <dxl:LessThanOp Mdid="0.0.0.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.0.0.0"/>
+ <dxl:GreaterThanOp Mdid="0.0.0.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.0.0.0"/>
+ <dxl:ComparisonOp Mdid="0.0.0.0"/>
+ <dxl:ArrayType Mdid="0.1012.1.0"/>
+ <dxl:MinAgg Mdid="0.0.0.0"/>
+ <dxl:MaxAgg Mdid="0.0.0.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.28.1.0" Name="xid" IsRedistributable="true" IsHashable="true" IsMergeJoinable="false" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="4" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.2225.1.0"/>
+ <dxl:EqualityOp Mdid="0.352.1.0"/>
+ <dxl:InequalityOp Mdid="0.3315.1.0"/>
+ <dxl:LessThanOp Mdid="0.0.0.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.0.0.0"/>
+ <dxl:GreaterThanOp Mdid="0.0.0.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.0.0.0"/>
+ <dxl:ComparisonOp Mdid="0.0.0.0"/>
+ <dxl:ArrayType Mdid="0.1011.1.0"/>
+ <dxl:MinAgg Mdid="0.0.0.0"/>
+ <dxl:MaxAgg Mdid="0.0.0.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.701.1.0" Name="float8" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="8" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.1971.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7102.1.0"/>
+ <dxl:PartOpfamily Mdid="0.1970.1.0"/>
+ <dxl:EqualityOp Mdid="0.670.1.0"/>
+ <dxl:InequalityOp Mdid="0.671.1.0"/>
+ <dxl:LessThanOp Mdid="0.672.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.673.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.674.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.675.1.0"/>
+ <dxl:ComparisonOp Mdid="0.355.1.0"/>
+ <dxl:ArrayType Mdid="0.1022.1.0"/>
+ <dxl:MinAgg Mdid="0.2136.1.0"/>
+ <dxl:MaxAgg Mdid="0.2120.1.0"/>
+ <dxl:AvgAgg Mdid="0.2105.1.0"/>
+ <dxl:SumAgg Mdid="0.2111.1.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:RelationExtendedStatistics Mdid="10.31033.1.0" Name="index_scan_null_test_preds"/>
+ <dxl:ColumnStatistics Mdid="1.31033.1.0.1" Name="b" Width="8.000000" NullFreq="0.000000" NdvRemain="0.000000" FreqRemain="0.000000" ColStatsMissing="true"/>
+ <dxl:ColumnStatistics Mdid="1.31033.1.0.0" Name="a" Width="4.000000" NullFreq="0.000000" NdvRemain="0.000000" FreqRemain="0.000000" ColStatsMissing="true"/>
+ </dxl:Metadata>
+ <dxl:Query>
+ <dxl:OutputColumns>
+ <dxl:Ident ColId="1" ColName="a" TypeMdid="0.23.1.0"/>
+ <dxl:Ident ColId="2" ColName="b" TypeMdid="0.701.1.0"/>
+ <dxl:Ident ColId="3" ColName="c" TypeMdid="0.25.1.0"/>
+ </dxl:OutputColumns>
+ <dxl:CTEList/>
+ <dxl:LogicalSelect>
+ <dxl:IsNotNull>
+ <dxl:Ident ColId="2" ColName="b" TypeMdid="0.701.1.0"/>
+ </dxl:IsNotNull>
+ <dxl:LogicalGet>
+ <dxl:TableDescriptor Mdid="6.31033.1.0" TableName="index_scan_null_test_preds" LockMode="1" AclMode="2">
+ <dxl:Columns>
+ <dxl:Column ColId="1" Attno="1" ColName="a" TypeMdid="0.23.1.0" ColWidth="4"/>
+ <dxl:Column ColId="2" Attno="2" ColName="b" TypeMdid="0.701.1.0" ColWidth="8"/>
+ <dxl:Column ColId="3" Attno="3" ColName="c" TypeMdid="0.25.1.0" ColWidth="8"/>
+ <dxl:Column ColId="4" Attno="-1" ColName="ctid" TypeMdid="0.27.1.0" ColWidth="6"/>
+ <dxl:Column ColId="5" Attno="-2" ColName="xmin" TypeMdid="0.28.1.0" ColWidth="4"/>
+ <dxl:Column ColId="6" Attno="-3" ColName="cmin" TypeMdid="0.29.1.0" ColWidth="4"/>
+ <dxl:Column ColId="7" Attno="-4" ColName="xmax" TypeMdid="0.28.1.0" ColWidth="4"/>
+ <dxl:Column ColId="8" Attno="-5" ColName="cmax" TypeMdid="0.29.1.0" ColWidth="4"/>
+ <dxl:Column ColId="9" Attno="-6" ColName="tableoid" TypeMdid="0.26.1.0" ColWidth="4"/>
+ <dxl:Column ColId="10" Attno="-7" ColName="gp_segment_id" TypeMdid="0.23.1.0" ColWidth="4"/>
+ </dxl:Columns>
+ </dxl:TableDescriptor>
+ </dxl:LogicalGet>
+ </dxl:LogicalSelect>
+ </dxl:Query>
+ <dxl:Plan Id="0" SpaceSize="2">
+ <dxl:GatherMotion InputSegments="0,1,2" OutputSegments="-1">
+ <dxl:Properties>
+ <dxl:Cost StartupCost="0" TotalCost="6.000203" Rows="1.000000" Width="20"/>
+ </dxl:Properties>
+ <dxl:ProjList>
+ <dxl:ProjElem ColId="0" Alias="a">
+ <dxl:Ident ColId="0" ColName="a" TypeMdid="0.23.1.0"/>
+ </dxl:ProjElem>
+ <dxl:ProjElem ColId="1" Alias="b">
+ <dxl:Ident ColId="1" ColName="b" TypeMdid="0.701.1.0"/>
+ </dxl:ProjElem>
+ <dxl:ProjElem ColId="2" Alias="c">
+ <dxl:Ident ColId="2" ColName="c" TypeMdid="0.25.1.0"/>
+ </dxl:ProjElem>
+ </dxl:ProjList>
+ <dxl:Filter/>
+ <dxl:SortingColumnList/>
+ <dxl:IndexScan IndexScanDirection="Forward">
+ <dxl:Properties>
+ <dxl:Cost StartupCost="0" TotalCost="6.000116" Rows="1.000000" Width="20"/>
+ </dxl:Properties>
+ <dxl:ProjList>
+ <dxl:ProjElem ColId="0" Alias="a">
+ <dxl:Ident ColId="0" ColName="a" TypeMdid="0.23.1.0"/>
+ </dxl:ProjElem>
+ <dxl:ProjElem ColId="1" Alias="b">
+ <dxl:Ident ColId="1" ColName="b" TypeMdid="0.701.1.0"/>
+ </dxl:ProjElem>
+ <dxl:ProjElem ColId="2" Alias="c">
+ <dxl:Ident ColId="2" ColName="c" TypeMdid="0.25.1.0"/>
+ </dxl:ProjElem>
+ </dxl:ProjList>
+ <dxl:Filter/>
+ <dxl:IndexCondList>
+ <dxl:Not>
+ <dxl:IsNull>
+ <dxl:Ident ColId="1" ColName="b" TypeMdid="0.701.1.0"/>
+ </dxl:IsNull>
+ </dxl:Not>
+ </dxl:IndexCondList>
+ <dxl:Partitions/>
+ <dxl:IndexDescriptor Mdid="7.31038.1.0" IndexName="idx_b"/>
+ <dxl:TableDescriptor Mdid="6.31033.1.0" TableName="index_scan_null_test_preds" LockMode="1" AclMode="2">
+ <dxl:Columns>
+ <dxl:Column ColId="0" Attno="1" ColName="a" TypeMdid="0.23.1.0" ColWidth="4"/>
+ <dxl:Column ColId="1" Attno="2" ColName="b" TypeMdid="0.701.1.0" ColWidth="8"/>
+ <dxl:Column ColId="2" Attno="3" ColName="c" TypeMdid="0.25.1.0" ColWidth="8"/>
+ <dxl:Column ColId="3" Attno="-1" ColName="ctid" TypeMdid="0.27.1.0" ColWidth="6"/>
+ <dxl:Column ColId="4" Attno="-2" ColName="xmin" TypeMdid="0.28.1.0" ColWidth="4"/>
+ <dxl:Column ColId="5" Attno="-3" ColName="cmin" TypeMdid="0.29.1.0" ColWidth="4"/>
+ <dxl:Column ColId="6" Attno="-4" ColName="xmax" TypeMdid="0.28.1.0" ColWidth="4"/>
+ <dxl:Column ColId="7" Attno="-5" ColName="cmax" TypeMdid="0.29.1.0" ColWidth="4"/>
+ <dxl:Column ColId="8" Attno="-6" ColName="tableoid" TypeMdid="0.26.1.0" ColWidth="4"/>
+ <dxl:Column ColId="9" Attno="-7" ColName="gp_segment_id" TypeMdid="0.23.1.0" ColWidth="4"/>
+ </dxl:Columns>
+ </dxl:TableDescriptor>
+ </dxl:IndexScan>
+ </dxl:GatherMotion>
+ </dxl:Plan>
+ </dxl:Thread>
+</dxl:DXLMessage>
diff --git a/src/backend/gporca/data/dxl/minidump/IndexScan-IsNullPred.mdp b/src/backend/gporca/data/dxl/minidump/IndexScan-IsNullPred.mdp
new file mode 100644
index 0000000000..e8a14e7c87
--- /dev/null
+++ b/src/backend/gporca/data/dxl/minidump/IndexScan-IsNullPred.mdp
@@ -0,0 +1,297 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<dxl:DXLMessage xmlns:dxl="http://greenplum.com/dxl/2010/12/">
+<dxl:Comment><![CDATA[
+
+ Objective of this test is to ensure IsNull predicates on btree indices use IndexScan
+
+ create table index_scan_null_test_preds(a int, b float, c text);
+ create index idx_b on index_scan_null_test_preds using btree(b);
+
+ Query: explain select * from index_scan_null_test_preds where b is null;
+
+ Plan:
+ QUERY PLAN
+
+ Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..6.00 rows=1 width=20)
+ -> Index Scan using idx_b on index_scan_null_test_preds (cost=0.00..6.00 rows=1 width=20)
+ Index Cond: (b IS NULL)
+ Optimizer: GPORCA
+ (4 rows)
+
+ ]]>
+ </dxl:Comment>
+ <dxl:Thread Id="0">
+ <dxl:OptimizerConfig>
+ <dxl:EnumeratorConfig Id="0" PlanSamples="0" CostThreshold="0"/>
+ <dxl:StatisticsConfig DampingFactorFilter="0.750000" DampingFactorJoin="0.000000" DampingFactorGroupBy="0.750000" MaxStatsBuckets="100"/>
+ <dxl:CTEConfig CTEInliningCutoff="0"/>
+ <dxl:WindowOids RowNumber="3100" Rank="3101"/>
+ <dxl:CostModelConfig CostModelType="1" SegmentsForCosting="3">
+ <dxl:CostParams>
+ <dxl:CostParam Name="NLJFactor" Value="1024.000000" LowerBound="1023.500000" UpperBound="1024.500000"/>
+ </dxl:CostParams>
+ </dxl:CostModelConfig>
+ <dxl:Hint JoinArityForAssociativityCommutativity="18" ArrayExpansionThreshold="20" JoinOrderDynamicProgThreshold="10" BroadcastThreshold="100000" EnforceConstraintsOnDML="false" PushGroupByBelowSetopThreshold="10" XformBindThreshold="0" SkewFactor="0"/>
+ <dxl:TraceFlags Value="102001,102002,102003,102043,102074,102120,102144,102162,102163,103001,103014,103022,103026,103027,103029,103033,103038,103040,104002,104003,104004,104005,105000,106000"/>
+ </dxl:OptimizerConfig>
+ <dxl:Metadata SystemIds="0.GPDB">
+ <dxl:Index Mdid="7.31038.1.0" Name="idx_b" IsClustered="false" AmCanOrder="true" IndexType="B-tree" IndexItemType="0.2283.1.0" KeyColumns="1" IncludedColumns="" ReturnableColumns="1" SortDirection="ASC" NullsDirection="LAST">
+ <dxl:Opfamilies>
+ <dxl:Opfamily Mdid="0.1970.1.0"/>
+ </dxl:Opfamilies>
+ </dxl:Index>
+ <dxl:RelationStatistics Mdid="2.31033.1.0" Name="index_scan_null_test_preds" Rows="0.000000" RelPages="0" RelAllVisible="0" EmptyRelation="true"/>
+ <dxl:Relation Mdid="6.31033.1.0" Name="index_scan_null_test_preds" IsTemporary="false" StorageType="Heap" DistributionPolicy="Hash" DistributionColumns="0" Keys="9,3">
+ <dxl:Columns>
+ <dxl:Column Name="a" Attno="1" Mdid="0.23.1.0" Nullable="true" ColWidth="4"/>
+ <dxl:Column Name="b" Attno="2" Mdid="0.701.1.0" Nullable="true" ColWidth="8"/>
+ <dxl:Column Name="c" Attno="3" Mdid="0.25.1.0" Nullable="true" ColWidth="8"/>
+ <dxl:Column Name="ctid" Attno="-1" Mdid="0.27.1.0" Nullable="false" ColWidth="6"/>
+ <dxl:Column Name="xmin" Attno="-2" Mdid="0.28.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="cmin" Attno="-3" Mdid="0.29.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="xmax" Attno="-4" Mdid="0.28.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="cmax" Attno="-5" Mdid="0.29.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="tableoid" Attno="-6" Mdid="0.26.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="gp_segment_id" Attno="-7" Mdid="0.23.1.0" Nullable="false" ColWidth="4"/>
+ </dxl:Columns>
+ <dxl:IndexInfoList>
+ <dxl:IndexInfo Mdid="7.31038.1.0" IsPartial="false"/>
+ </dxl:IndexInfoList>
+ <dxl:CheckConstraints/>
+ <dxl:DistrOpfamilies>
+ <dxl:DistrOpfamily Mdid="0.1977.1.0"/>
+ </dxl:DistrOpfamilies>
+ </dxl:Relation>
+ <dxl:Type Mdid="0.16.1.0" Name="bool" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="1" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.2222.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7124.1.0"/>
+ <dxl:PartOpfamily Mdid="0.424.1.0"/>
+ <dxl:EqualityOp Mdid="0.91.1.0"/>
+ <dxl:InequalityOp Mdid="0.85.1.0"/>
+ <dxl:LessThanOp Mdid="0.58.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.1694.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.59.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.1695.1.0"/>
+ <dxl:ComparisonOp Mdid="0.1693.1.0"/>
+ <dxl:ArrayType Mdid="0.1000.1.0"/>
+ <dxl:MinAgg Mdid="0.0.0.0"/>
+ <dxl:MaxAgg Mdid="0.0.0.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.23.1.0" Name="int4" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="4" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.1977.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7100.1.0"/>
+ <dxl:PartOpfamily Mdid="0.1976.1.0"/>
+ <dxl:EqualityOp Mdid="0.96.1.0"/>
+ <dxl:InequalityOp Mdid="0.518.1.0"/>
+ <dxl:LessThanOp Mdid="0.97.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.523.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.521.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.525.1.0"/>
+ <dxl:ComparisonOp Mdid="0.351.1.0"/>
+ <dxl:ArrayType Mdid="0.1007.1.0"/>
+ <dxl:MinAgg Mdid="0.2132.1.0"/>
+ <dxl:MaxAgg Mdid="0.2116.1.0"/>
+ <dxl:AvgAgg Mdid="0.2101.1.0"/>
+ <dxl:SumAgg Mdid="0.2108.1.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.25.1.0" Name="text" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="true" IsFixedLength="false" Length="-1" PassByValue="false">
+ <dxl:DistrOpfamily Mdid="0.1995.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7105.1.0"/>
+ <dxl:PartOpfamily Mdid="0.1994.1.0"/>
+ <dxl:EqualityOp Mdid="0.98.1.0"/>
+ <dxl:InequalityOp Mdid="0.531.1.0"/>
+ <dxl:LessThanOp Mdid="0.664.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.665.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.666.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.667.1.0"/>
+ <dxl:ComparisonOp Mdid="0.360.1.0"/>
+ <dxl:ArrayType Mdid="0.1009.1.0"/>
+ <dxl:MinAgg Mdid="0.2145.1.0"/>
+ <dxl:MaxAgg Mdid="0.2129.1.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.26.1.0" Name="oid" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="4" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.1990.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7109.1.0"/>
+ <dxl:PartOpfamily Mdid="0.1989.1.0"/>
+ <dxl:EqualityOp Mdid="0.607.1.0"/>
+ <dxl:InequalityOp Mdid="0.608.1.0"/>
+ <dxl:LessThanOp Mdid="0.609.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.611.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.610.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.612.1.0"/>
+ <dxl:ComparisonOp Mdid="0.356.1.0"/>
+ <dxl:ArrayType Mdid="0.1028.1.0"/>
+ <dxl:MinAgg Mdid="0.2134.1.0"/>
+ <dxl:MaxAgg Mdid="0.2118.1.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.27.1.0" Name="tid" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="6" PassByValue="false">
+ <dxl:DistrOpfamily Mdid="0.2227.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7110.1.0"/>
+ <dxl:PartOpfamily Mdid="0.2789.1.0"/>
+ <dxl:EqualityOp Mdid="0.387.1.0"/>
+ <dxl:InequalityOp Mdid="0.402.1.0"/>
+ <dxl:LessThanOp Mdid="0.2799.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.2801.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.2800.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.2802.1.0"/>
+ <dxl:ComparisonOp Mdid="0.2794.1.0"/>
+ <dxl:ArrayType Mdid="0.1010.1.0"/>
+ <dxl:MinAgg Mdid="0.2798.1.0"/>
+ <dxl:MaxAgg Mdid="0.2797.1.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.29.1.0" Name="cid" IsRedistributable="true" IsHashable="true" IsMergeJoinable="false" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="4" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.2226.1.0"/>
+ <dxl:EqualityOp Mdid="0.385.1.0"/>
+ <dxl:InequalityOp Mdid="0.0.0.0"/>
+ <dxl:LessThanOp Mdid="0.0.0.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.0.0.0"/>
+ <dxl:GreaterThanOp Mdid="0.0.0.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.0.0.0"/>
+ <dxl:ComparisonOp Mdid="0.0.0.0"/>
+ <dxl:ArrayType Mdid="0.1012.1.0"/>
+ <dxl:MinAgg Mdid="0.0.0.0"/>
+ <dxl:MaxAgg Mdid="0.0.0.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.28.1.0" Name="xid" IsRedistributable="true" IsHashable="true" IsMergeJoinable="false" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="4" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.2225.1.0"/>
+ <dxl:EqualityOp Mdid="0.352.1.0"/>
+ <dxl:InequalityOp Mdid="0.3315.1.0"/>
+ <dxl:LessThanOp Mdid="0.0.0.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.0.0.0"/>
+ <dxl:GreaterThanOp Mdid="0.0.0.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.0.0.0"/>
+ <dxl:ComparisonOp Mdid="0.0.0.0"/>
+ <dxl:ArrayType Mdid="0.1011.1.0"/>
+ <dxl:MinAgg Mdid="0.0.0.0"/>
+ <dxl:MaxAgg Mdid="0.0.0.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.701.1.0" Name="float8" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="8" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.1971.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7102.1.0"/>
+ <dxl:PartOpfamily Mdid="0.1970.1.0"/>
+ <dxl:EqualityOp Mdid="0.670.1.0"/>
+ <dxl:InequalityOp Mdid="0.671.1.0"/>
+ <dxl:LessThanOp Mdid="0.672.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.673.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.674.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.675.1.0"/>
+ <dxl:ComparisonOp Mdid="0.355.1.0"/>
+ <dxl:ArrayType Mdid="0.1022.1.0"/>
+ <dxl:MinAgg Mdid="0.2136.1.0"/>
+ <dxl:MaxAgg Mdid="0.2120.1.0"/>
+ <dxl:AvgAgg Mdid="0.2105.1.0"/>
+ <dxl:SumAgg Mdid="0.2111.1.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:RelationExtendedStatistics Mdid="10.31033.1.0" Name="index_scan_null_test_preds"/>
+ <dxl:ColumnStatistics Mdid="1.31033.1.0.1" Name="b" Width="8.000000" NullFreq="0.000000" NdvRemain="0.000000" FreqRemain="0.000000" ColStatsMissing="true"/>
+ <dxl:ColumnStatistics Mdid="1.31033.1.0.0" Name="a" Width="4.000000" NullFreq="0.000000" NdvRemain="0.000000" FreqRemain="0.000000" ColStatsMissing="true"/>
+ </dxl:Metadata>
+ <dxl:Query>
+ <dxl:OutputColumns>
+ <dxl:Ident ColId="1" ColName="a" TypeMdid="0.23.1.0"/>
+ <dxl:Ident ColId="2" ColName="b" TypeMdid="0.701.1.0"/>
+ <dxl:Ident ColId="3" ColName="c" TypeMdid="0.25.1.0"/>
+ </dxl:OutputColumns>
+ <dxl:CTEList/>
+ <dxl:LogicalSelect>
+ <dxl:IsNull>
+ <dxl:Ident ColId="2" ColName="b" TypeMdid="0.701.1.0"/>
+ </dxl:IsNull>
+ <dxl:LogicalGet>
+ <dxl:TableDescriptor Mdid="6.31033.1.0" TableName="index_scan_null_test_preds" LockMode="1" AclMode="2">
+ <dxl:Columns>
+ <dxl:Column ColId="1" Attno="1" ColName="a" TypeMdid="0.23.1.0" ColWidth="4"/>
+ <dxl:Column ColId="2" Attno="2" ColName="b" TypeMdid="0.701.1.0" ColWidth="8"/>
+ <dxl:Column ColId="3" Attno="3" ColName="c" TypeMdid="0.25.1.0" ColWidth="8"/>
+ <dxl:Column ColId="4" Attno="-1" ColName="ctid" TypeMdid="0.27.1.0" ColWidth="6"/>
+ <dxl:Column ColId="5" Attno="-2" ColName="xmin" TypeMdid="0.28.1.0" ColWidth="4"/>
+ <dxl:Column ColId="6" Attno="-3" ColName="cmin" TypeMdid="0.29.1.0" ColWidth="4"/>
+ <dxl:Column ColId="7" Attno="-4" ColName="xmax" TypeMdid="0.28.1.0" ColWidth="4"/>
+ <dxl:Column ColId="8" Attno="-5" ColName="cmax" TypeMdid="0.29.1.0" ColWidth="4"/>
+ <dxl:Column ColId="9" Attno="-6" ColName="tableoid" TypeMdid="0.26.1.0" ColWidth="4"/>
+ <dxl:Column ColId="10" Attno="-7" ColName="gp_segment_id" TypeMdid="0.23.1.0" ColWidth="4"/>
+ </dxl:Columns>
+ </dxl:TableDescriptor>
+ </dxl:LogicalGet>
+ </dxl:LogicalSelect>
+ </dxl:Query>
+ <dxl:Plan Id="0" SpaceSize="2">
+ <dxl:GatherMotion InputSegments="0,1,2" OutputSegments="-1">
+ <dxl:Properties>
+ <dxl:Cost StartupCost="0" TotalCost="6.000203" Rows="1.000000" Width="20"/>
+ </dxl:Properties>
+ <dxl:ProjList>
+ <dxl:ProjElem ColId="0" Alias="a">
+ <dxl:Ident ColId="0" ColName="a" TypeMdid="0.23.1.0"/>
+ </dxl:ProjElem>
+ <dxl:ProjElem ColId="1" Alias="b">
+ <dxl:Ident ColId="1" ColName="b" TypeMdid="0.701.1.0"/>
+ </dxl:ProjElem>
+ <dxl:ProjElem ColId="2" Alias="c">
+ <dxl:Ident ColId="2" ColName="c" TypeMdid="0.25.1.0"/>
+ </dxl:ProjElem>
+ </dxl:ProjList>
+ <dxl:Filter/>
+ <dxl:SortingColumnList/>
+ <dxl:IndexScan IndexScanDirection="Forward">
+ <dxl:Properties>
+ <dxl:Cost StartupCost="0" TotalCost="6.000116" Rows="1.000000" Width="20"/>
+ </dxl:Properties>
+ <dxl:ProjList>
+ <dxl:ProjElem ColId="0" Alias="a">
+ <dxl:Ident ColId="0" ColName="a" TypeMdid="0.23.1.0"/>
+ </dxl:ProjElem>
+ <dxl:ProjElem ColId="1" Alias="b">
+ <dxl:Ident ColId="1" ColName="b" TypeMdid="0.701.1.0"/>
+ </dxl:ProjElem>
+ <dxl:ProjElem ColId="2" Alias="c">
+ <dxl:Ident ColId="2" ColName="c" TypeMdid="0.25.1.0"/>
+ </dxl:ProjElem>
+ </dxl:ProjList>
+ <dxl:Filter/>
+ <dxl:IndexCondList>
+ <dxl:IsNull>
+ <dxl:Ident ColId="1" ColName="b" TypeMdid="0.701.1.0"/>
+ </dxl:IsNull>
+ </dxl:IndexCondList>
+ <dxl:Partitions/>
+ <dxl:IndexDescriptor Mdid="7.31038.1.0" IndexName="idx_b"/>
+ <dxl:TableDescriptor Mdid="6.31033.1.0" TableName="index_scan_null_test_preds" LockMode="1" AclMode="2">
+ <dxl:Columns>
+ <dxl:Column ColId="0" Attno="1" ColName="a" TypeMdid="0.23.1.0" ColWidth="4"/>
+ <dxl:Column ColId="1" Attno="2" ColName="b" TypeMdid="0.701.1.0" ColWidth="8"/>
+ <dxl:Column ColId="2" Attno="3" ColName="c" TypeMdid="0.25.1.0" ColWidth="8"/>
+ <dxl:Column ColId="3" Attno="-1" ColName="ctid" TypeMdid="0.27.1.0" ColWidth="6"/>
+ <dxl:Column ColId="4" Attno="-2" ColName="xmin" TypeMdid="0.28.1.0" ColWidth="4"/>
+ <dxl:Column ColId="5" Attno="-3" ColName="cmin" TypeMdid="0.29.1.0" ColWidth="4"/>
+ <dxl:Column ColId="6" Attno="-4" ColName="xmax" TypeMdid="0.28.1.0" ColWidth="4"/>
+ <dxl:Column ColId="7" Attno="-5" ColName="cmax" TypeMdid="0.29.1.0" ColWidth="4"/>
+ <dxl:Column ColId="8" Attno="-6" ColName="tableoid" TypeMdid="0.26.1.0" ColWidth="4"/>
+ <dxl:Column ColId="9" Attno="-7" ColName="gp_segment_id" TypeMdid="0.23.1.0" ColWidth="4"/>
+ </dxl:Columns>
+ </dxl:TableDescriptor>
+ </dxl:IndexScan>
+ </dxl:GatherMotion>
+ </dxl:Plan>
+ </dxl:Thread>
+</dxl:DXLMessage>
diff --git a/src/backend/gporca/data/dxl/minidump/Max-Aggregate-uses-IndexScan-and-Limit.mdp b/src/backend/gporca/data/dxl/minidump/Max-Aggregate-uses-IndexScan-and-Limit.mdp
new file mode 100644
index 0000000000..4d202daaf4
--- /dev/null
+++ b/src/backend/gporca/data/dxl/minidump/Max-Aggregate-uses-IndexScan-and-Limit.mdp
@@ -0,0 +1,1195 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<dxl:DXLMessage xmlns:dxl="http://greenplum.com/dxl/2010/12/">
+<dxl:Comment><![CDATA[
+
+ Objective of this test is to ensure if max() aggregate on an btree index column is optimized
+ to use a plan with IndexScan and Limit.
+
+ create table optimize_min_max_aggregates(a int, b text, c float, d int);
+ create index index_bc on optimize_min_max_aggregates using btree(b,c);
+ insert into optimize_min_max_aggregates select i, concat('col_b', i), i/4.1, i*2 from generate_series(1,10000)i;
+ analyze optimize_min_max_aggregates;
+
+ Query: explain select max(b) from optimize_min_max_aggregates;
+
+ Plan:
+ QUERY PLAN
+
+ Aggregate (cost=0.00..7.83 rows=1 width=8)
+ -> Limit (cost=0.00..7.83 rows=1 width=9)
+ -> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..7.83 rows=1 width=9)
+ Merge Key: b
+ -> Limit (cost=0.00..7.83 rows=1 width=9)
+ -> Index Scan Backward using index_bc on optimize_min_max_aggregates (cost=0.00..7.77 rows=3334 width=9)
+ Index Cond: (b IS NOT NULL)
+ Optimizer: GPORCA
+ (8 rows)
+ ]]>
+ </dxl:Comment>
+ <dxl:Thread Id="0">
+ <dxl:OptimizerConfig>
+ <dxl:EnumeratorConfig Id="0" PlanSamples="0" CostThreshold="0"/>
+ <dxl:StatisticsConfig DampingFactorFilter="0.750000" DampingFactorJoin="0.000000" DampingFactorGroupBy="0.750000" MaxStatsBuckets="100"/>
+ <dxl:CTEConfig CTEInliningCutoff="0"/>
+ <dxl:WindowOids RowNumber="3100" Rank="3101"/>
+ <dxl:CostModelConfig CostModelType="1" SegmentsForCosting="3">
+ <dxl:CostParams>
+ <dxl:CostParam Name="NLJFactor" Value="1024.000000" LowerBound="1023.500000" UpperBound="1024.500000"/>
+ </dxl:CostParams>
+ </dxl:CostModelConfig>
+ <dxl:Hint JoinArityForAssociativityCommutativity="18" ArrayExpansionThreshold="20" JoinOrderDynamicProgThreshold="10" BroadcastThreshold="100000" EnforceConstraintsOnDML="false" PushGroupByBelowSetopThreshold="10" XformBindThreshold="0" SkewFactor="0"/>
+ <dxl:TraceFlags Value="102001,102002,102003,102043,102074,102120,102144,102162,102163,103001,103014,103022,103026,103027,103029,103033,103038,103040,104002,104003,104004,104005,105000,106000"/>
+ </dxl:OptimizerConfig>
+ <dxl:Metadata SystemIds="0.GPDB">
+ <dxl:Index Mdid="7.17330.1.0" Name="index_bc" IsClustered="false" AmCanOrder="true" IndexType="B-tree" IndexItemType="0.2283.1.0" KeyColumns="1,2" IncludedColumns="" ReturnableColumns="1,2" SortDirection="ASC,ASC" NullsDirection="LAST,LAST">
+ <dxl:Opfamilies>
+ <dxl:Opfamily Mdid="0.1994.1.0"/>
+ <dxl:Opfamily Mdid="0.1970.1.0"/>
+ </dxl:Opfamilies>
+ </dxl:Index>
+ <dxl:Type Mdid="0.16.1.0" Name="bool" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="1" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.2222.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7124.1.0"/>
+ <dxl:PartOpfamily Mdid="0.424.1.0"/>
+ <dxl:EqualityOp Mdid="0.91.1.0"/>
+ <dxl:InequalityOp Mdid="0.85.1.0"/>
+ <dxl:LessThanOp Mdid="0.58.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.1694.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.59.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.1695.1.0"/>
+ <dxl:ComparisonOp Mdid="0.1693.1.0"/>
+ <dxl:ArrayType Mdid="0.1000.1.0"/>
+ <dxl:MinAgg Mdid="0.0.0.0"/>
+ <dxl:MaxAgg Mdid="0.0.0.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.20.1.0" Name="Int8" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="8" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.1977.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7100.1.0"/>
+ <dxl:PartOpfamily Mdid="0.1976.1.0"/>
+ <dxl:EqualityOp Mdid="0.410.1.0"/>
+ <dxl:InequalityOp Mdid="0.411.1.0"/>
+ <dxl:LessThanOp Mdid="0.412.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.414.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.413.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.415.1.0"/>
+ <dxl:ComparisonOp Mdid="0.351.1.0"/>
+ <dxl:ArrayType Mdid="0.1016.1.0"/>
+ <dxl:MinAgg Mdid="0.2131.1.0"/>
+ <dxl:MaxAgg Mdid="0.2115.1.0"/>
+ <dxl:AvgAgg Mdid="0.2100.1.0"/>
+ <dxl:SumAgg Mdid="0.2107.1.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.23.1.0" Name="int4" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="4" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.1977.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7100.1.0"/>
+ <dxl:PartOpfamily Mdid="0.1976.1.0"/>
+ <dxl:EqualityOp Mdid="0.96.1.0"/>
+ <dxl:InequalityOp Mdid="0.518.1.0"/>
+ <dxl:LessThanOp Mdid="0.97.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.523.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.521.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.525.1.0"/>
+ <dxl:ComparisonOp Mdid="0.351.1.0"/>
+ <dxl:ArrayType Mdid="0.1007.1.0"/>
+ <dxl:MinAgg Mdid="0.2132.1.0"/>
+ <dxl:MaxAgg Mdid="0.2116.1.0"/>
+ <dxl:AvgAgg Mdid="0.2101.1.0"/>
+ <dxl:SumAgg Mdid="0.2108.1.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.25.1.0" Name="text" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="true" IsFixedLength="false" Length="-1" PassByValue="false">
+ <dxl:DistrOpfamily Mdid="0.1995.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7105.1.0"/>
+ <dxl:PartOpfamily Mdid="0.1994.1.0"/>
+ <dxl:EqualityOp Mdid="0.98.1.0"/>
+ <dxl:InequalityOp Mdid="0.531.1.0"/>
+ <dxl:LessThanOp Mdid="0.664.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.665.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.666.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.667.1.0"/>
+ <dxl:ComparisonOp Mdid="0.360.1.0"/>
+ <dxl:ArrayType Mdid="0.1009.1.0"/>
+ <dxl:MinAgg Mdid="0.2145.1.0"/>
+ <dxl:MaxAgg Mdid="0.2129.1.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:GPDBScalarOp Mdid="0.666.1.0" Name=">" ComparisonType="GT" ReturnsNullOnNullInput="true" IsNDVPreserving="false">
+ <dxl:LeftType Mdid="0.25.1.0"/>
+ <dxl:RightType Mdid="0.25.1.0"/>
+ <dxl:ResultType Mdid="0.16.1.0"/>
+ <dxl:OpFunc Mdid="0.742.1.0"/>
+ <dxl:Commutator Mdid="0.664.1.0"/>
+ <dxl:InverseOp Mdid="0.665.1.0"/>
+ <dxl:Opfamilies>
+ <dxl:Opfamily Mdid="0.1994.1.0"/>
+ <dxl:Opfamily Mdid="0.4017.1.0"/>
+ <dxl:Opfamily Mdid="0.4056.1.0"/>
+ <dxl:Opfamily Mdid="0.10018.1.0"/>
+ </dxl:Opfamilies>
+ </dxl:GPDBScalarOp>
+ <dxl:Type Mdid="0.26.1.0" Name="oid" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="4" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.1990.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7109.1.0"/>
+ <dxl:PartOpfamily Mdid="0.1989.1.0"/>
+ <dxl:EqualityOp Mdid="0.607.1.0"/>
+ <dxl:InequalityOp Mdid="0.608.1.0"/>
+ <dxl:LessThanOp Mdid="0.609.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.611.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.610.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.612.1.0"/>
+ <dxl:ComparisonOp Mdid="0.356.1.0"/>
+ <dxl:ArrayType Mdid="0.1028.1.0"/>
+ <dxl:MinAgg Mdid="0.2134.1.0"/>
+ <dxl:MaxAgg Mdid="0.2118.1.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.27.1.0" Name="tid" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="6" PassByValue="false">
+ <dxl:DistrOpfamily Mdid="0.2227.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7110.1.0"/>
+ <dxl:PartOpfamily Mdid="0.2789.1.0"/>
+ <dxl:EqualityOp Mdid="0.387.1.0"/>
+ <dxl:InequalityOp Mdid="0.402.1.0"/>
+ <dxl:LessThanOp Mdid="0.2799.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.2801.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.2800.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.2802.1.0"/>
+ <dxl:ComparisonOp Mdid="0.2794.1.0"/>
+ <dxl:ArrayType Mdid="0.1010.1.0"/>
+ <dxl:MinAgg Mdid="0.2798.1.0"/>
+ <dxl:MaxAgg Mdid="0.2797.1.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.29.1.0" Name="cid" IsRedistributable="true" IsHashable="true" IsMergeJoinable="false" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="4" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.2226.1.0"/>
+ <dxl:EqualityOp Mdid="0.385.1.0"/>
+ <dxl:InequalityOp Mdid="0.0.0.0"/>
+ <dxl:LessThanOp Mdid="0.0.0.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.0.0.0"/>
+ <dxl:GreaterThanOp Mdid="0.0.0.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.0.0.0"/>
+ <dxl:ComparisonOp Mdid="0.0.0.0"/>
+ <dxl:ArrayType Mdid="0.1012.1.0"/>
+ <dxl:MinAgg Mdid="0.0.0.0"/>
+ <dxl:MaxAgg Mdid="0.0.0.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.28.1.0" Name="xid" IsRedistributable="true" IsHashable="true" IsMergeJoinable="false" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="4" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.2225.1.0"/>
+ <dxl:EqualityOp Mdid="0.352.1.0"/>
+ <dxl:InequalityOp Mdid="0.3315.1.0"/>
+ <dxl:LessThanOp Mdid="0.0.0.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.0.0.0"/>
+ <dxl:GreaterThanOp Mdid="0.0.0.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.0.0.0"/>
+ <dxl:ComparisonOp Mdid="0.0.0.0"/>
+ <dxl:ArrayType Mdid="0.1011.1.0"/>
+ <dxl:MinAgg Mdid="0.0.0.0"/>
+ <dxl:MaxAgg Mdid="0.0.0.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:RelationStatistics Mdid="2.17325.1.0" Name="optimize_min_max_aggregates" Rows="10000.000000" RelPages="20" RelAllVisible="0" EmptyRelation="false"/>
+ <dxl:Relation Mdid="6.17325.1.0" Name="optimize_min_max_aggregates" IsTemporary="false" StorageType="Heap" DistributionPolicy="Hash" DistributionColumns="0" Keys="10,4">
+ <dxl:Columns>
+ <dxl:Column Name="a" Attno="1" Mdid="0.23.1.0" Nullable="true" ColWidth="4"/>
+ <dxl:Column Name="b" Attno="2" Mdid="0.25.1.0" Nullable="true" ColWidth="9"/>
+ <dxl:Column Name="c" Attno="3" Mdid="0.701.1.0" Nullable="true" ColWidth="8"/>
+ <dxl:Column Name="d" Attno="4" Mdid="0.23.1.0" Nullable="true" ColWidth="4"/>
+ <dxl:Column Name="ctid" Attno="-1" Mdid="0.27.1.0" Nullable="false" ColWidth="6"/>
+ <dxl:Column Name="xmin" Attno="-2" Mdid="0.28.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="cmin" Attno="-3" Mdid="0.29.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="xmax" Attno="-4" Mdid="0.28.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="cmax" Attno="-5" Mdid="0.29.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="tableoid" Attno="-6" Mdid="0.26.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="gp_segment_id" Attno="-7" Mdid="0.23.1.0" Nullable="false" ColWidth="4"/>
+ </dxl:Columns>
+ <dxl:IndexInfoList>
+ <dxl:IndexInfo Mdid="7.17330.1.0" IsPartial="false"/>
+ </dxl:IndexInfoList>
+ <dxl:CheckConstraints/>
+ <dxl:DistrOpfamilies>
+ <dxl:DistrOpfamily Mdid="0.1977.1.0"/>
+ </dxl:DistrOpfamilies>
+ </dxl:Relation>
+ <dxl:Type Mdid="0.701.1.0" Name="float8" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="8" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.1971.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7102.1.0"/>
+ <dxl:PartOpfamily Mdid="0.1970.1.0"/>
+ <dxl:EqualityOp Mdid="0.670.1.0"/>
+ <dxl:InequalityOp Mdid="0.671.1.0"/>
+ <dxl:LessThanOp Mdid="0.672.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.673.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.674.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.675.1.0"/>
+ <dxl:ComparisonOp Mdid="0.355.1.0"/>
+ <dxl:ArrayType Mdid="0.1022.1.0"/>
+ <dxl:MinAgg Mdid="0.2136.1.0"/>
+ <dxl:MaxAgg Mdid="0.2120.1.0"/>
+ <dxl:AvgAgg Mdid="0.2105.1.0"/>
+ <dxl:SumAgg Mdid="0.2111.1.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:GPDBAgg Mdid="0.2129.1.0" Name="max" IsRepSafe="true" IsSplittable="true" HashAggCapable="true">
+ <dxl:ResultType Mdid="0.25.1.0"/>
+ <dxl:IntermediateResultType Mdid="0.25.1.0"/>
+ </dxl:GPDBAgg>
+ <dxl:ColumnStatistics Mdid="1.17325.1.0.1" Name="b" Width="9.000000" NullFreq="0.000000" NdvRemain="10000.000000" FreqRemain="1.000000" ColStatsMissing="false"/>
+ <dxl:ColumnStatistics Mdid="1.17325.1.0.0" Name="a" Width="4.000000" NullFreq="0.000000" NdvRemain="0.000000" FreqRemain="0.000000" ColStatsMissing="false">
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="900"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1900"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2900"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3900"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4900"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5900"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6900"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7900"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8900"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9900"/>
+ <dxl:UpperBound Closed="true" TypeMdid="0.23.1.0" Value="10000"/>
+ </dxl:StatsBucket>
+ </dxl:ColumnStatistics>
+ <dxl:ColumnStatistics Mdid="1.17325.1.0.2" Name="c" Width="8.000000" NullFreq="0.000000" NdvRemain="0.000000" FreqRemain="0.000000" ColStatsMissing="false">
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="OB+D8zE4zz8=" DoubleValue="0.24390243902439024"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="ZHA+BudjOEA=" DoubleValue="24.39024390243902474"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="ZHA+BudjOEA=" DoubleValue="24.39024390243902474"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="ZHA+BudjSEA=" DoubleValue="48.78048780487804947"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="ZHA+BudjSEA=" DoubleValue="48.78048780487804947"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="S9SuRO1KUkA=" DoubleValue="73.17073170731707421"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="S9SuRO1KUkA=" DoubleValue="73.17073170731707421"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="ZHA+BudjWEA=" DoubleValue="97.56097560975609895"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="ZHA+BudjWEA=" DoubleValue="97.56097560975609895"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="fQzOx+B8XkA=" DoubleValue="121.95121951219512368"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="fQzOx+B8XkA=" DoubleValue="121.95121951219512368"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="S9SuRO1KYkA=" DoubleValue="146.34146341463414842"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="S9SuRO1KYkA=" DoubleValue="146.34146341463414842"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="V6J2JWpXZUA=" DoubleValue="170.73170731707315895"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="V6J2JWpXZUA=" DoubleValue="170.73170731707315895"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="ZHA+BudjaEA=" DoubleValue="195.12195121951219789"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="ZHA+BudjaEA=" DoubleValue="195.12195121951219789"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="cD4G52Nwa0A=" DoubleValue="219.51219512195120842"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="cD4G52Nwa0A=" DoubleValue="219.51219512195120842"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="fQzOx+B8bkA=" DoubleValue="243.90243902439024737"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="fQzOx+B8bkA=" DoubleValue="243.90243902439024737"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="Re1K1K7EcEA=" DoubleValue="268.29268292682928632"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="Re1K1K7EcEA=" DoubleValue="268.29268292682928632"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="S9SuRO1KckA=" DoubleValue="292.68292682926829684"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="S9SuRO1KckA=" DoubleValue="292.68292682926829684"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="UbsStSvRc0A=" DoubleValue="317.07317073170730737"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="UbsStSvRc0A=" DoubleValue="317.07317073170730737"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="V6J2JWpXdUA=" DoubleValue="341.46341463414631789"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="V6J2JWpXdUA=" DoubleValue="341.46341463414631789"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="XonalajddkA=" DoubleValue="365.85365853658538526"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="XonalajddkA=" DoubleValue="365.85365853658538526"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="ZHA+BudjeEA=" DoubleValue="390.24390243902439579"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="ZHA+BudjeEA=" DoubleValue="390.24390243902439579"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="aleidiXqeUA=" DoubleValue="414.63414634146340632"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="aleidiXqeUA=" DoubleValue="414.63414634146340632"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="cD4G52Nwe0A=" DoubleValue="439.02439024390241684"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="cD4G52Nwe0A=" DoubleValue="439.02439024390241684"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="dyVqV6L2fEA=" DoubleValue="463.41463414634148421"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="dyVqV6L2fEA=" DoubleValue="463.41463414634148421"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="fQzOx+B8fkA=" DoubleValue="487.80487804878049474"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="fQzOx+B8fkA=" DoubleValue="487.80487804878049474"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="wvkYnI8BgEA=" DoubleValue="512.19512195121956211"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="wvkYnI8BgEA=" DoubleValue="512.19512195121956211"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="Re1K1K7EgEA=" DoubleValue="536.58536585365857263"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="Re1K1K7EgEA=" DoubleValue="536.58536585365857263"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="yOB8DM6HgUA=" DoubleValue="560.97560975609758316"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="yOB8DM6HgUA=" DoubleValue="560.97560975609758316"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="S9SuRO1KgkA=" DoubleValue="585.36585365853659368"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="S9SuRO1KgkA=" DoubleValue="585.36585365853659368"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="zsfgfAwOg0A=" DoubleValue="609.75609756097560421"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="zsfgfAwOg0A=" DoubleValue="609.75609756097560421"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="UbsStSvRg0A=" DoubleValue="634.14634146341461474"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="UbsStSvRg0A=" DoubleValue="634.14634146341461474"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="1K5E7UqUhEA=" DoubleValue="658.53658536585362526"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="1K5E7UqUhEA=" DoubleValue="658.53658536585362526"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="V6J2JWpXhUA=" DoubleValue="682.92682926829263579"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="V6J2JWpXhUA=" DoubleValue="682.92682926829263579"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="25WoXYkahkA=" DoubleValue="707.31707317073176000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="25WoXYkahkA=" DoubleValue="707.31707317073176000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="XonalajdhkA=" DoubleValue="731.70731707317077053"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="XonalajdhkA=" DoubleValue="731.70731707317077053"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="4XwMzsegh0A=" DoubleValue="756.09756097560978105"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="4XwMzsegh0A=" DoubleValue="756.09756097560978105"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="ZHA+BudjiEA=" DoubleValue="780.48780487804879158"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="ZHA+BudjiEA=" DoubleValue="780.48780487804879158"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="52NwPgYniUA=" DoubleValue="804.87804878048780211"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="52NwPgYniUA=" DoubleValue="804.87804878048780211"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="aleidiXqiUA=" DoubleValue="829.26829268292681263"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="aleidiXqiUA=" DoubleValue="829.26829268292681263"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="7UrUrkStikA=" DoubleValue="853.65853658536582316"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="7UrUrkStikA=" DoubleValue="853.65853658536582316"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="cD4G52Nwi0A=" DoubleValue="878.04878048780483368"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="cD4G52Nwi0A=" DoubleValue="878.04878048780483368"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="9DE4H4MzjEA=" DoubleValue="902.43902439024395790"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="9DE4H4MzjEA=" DoubleValue="902.43902439024395790"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="dyVqV6L2jEA=" DoubleValue="926.82926829268296842"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="dyVqV6L2jEA=" DoubleValue="926.82926829268296842"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="+hicj8G5jUA=" DoubleValue="951.21951219512197895"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="+hicj8G5jUA=" DoubleValue="951.21951219512197895"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="fQzOx+B8jkA=" DoubleValue="975.60975609756098947"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="fQzOx+B8jkA=" DoubleValue="975.60975609756098947"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="AAAAAABAj0A=" DoubleValue="1000.00000000000000000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="AAAAAABAj0A=" DoubleValue="1000.00000000000000000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="wvkYnI8BkEA=" DoubleValue="1024.39024390243912421"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="wvkYnI8BkEA=" DoubleValue="1024.39024390243912421"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="g/MxOB9jkEA=" DoubleValue="1048.78048780487802105"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="g/MxOB9jkEA=" DoubleValue="1048.78048780487802105"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="Re1K1K7EkEA=" DoubleValue="1073.17073170731714526"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="Re1K1K7EkEA=" DoubleValue="1073.17073170731714526"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="BudjcD4mkUA=" DoubleValue="1097.56097560975604210"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="BudjcD4mkUA=" DoubleValue="1097.56097560975604210"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="yOB8DM6HkUA=" DoubleValue="1121.95121951219516632"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="yOB8DM6HkUA=" DoubleValue="1121.95121951219516632"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="idqVqF3pkUA=" DoubleValue="1146.34146341463406316"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="idqVqF3pkUA=" DoubleValue="1146.34146341463406316"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="S9SuRO1KkkA=" DoubleValue="1170.73170731707318737"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="S9SuRO1KkkA=" DoubleValue="1170.73170731707318737"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="DM7H4HyskkA=" DoubleValue="1195.12195121951208421"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="DM7H4HyskkA=" DoubleValue="1195.12195121951208421"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="zsfgfAwOk0A=" DoubleValue="1219.51219512195120842"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="zsfgfAwOk0A=" DoubleValue="1219.51219512195120842"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="kMH5GJxvk0A=" DoubleValue="1243.90243902439033263"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="kMH5GJxvk0A=" DoubleValue="1243.90243902439033263"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="UbsStSvRk0A=" DoubleValue="1268.29268292682922947"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="UbsStSvRk0A=" DoubleValue="1268.29268292682922947"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="E7UrUbsylEA=" DoubleValue="1292.68292682926835369"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="E7UrUbsylEA=" DoubleValue="1292.68292682926835369"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="1K5E7UqUlEA=" DoubleValue="1317.07317073170725052"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="1K5E7UqUlEA=" DoubleValue="1317.07317073170725052"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="lqhdidr1lEA=" DoubleValue="1341.46341463414637474"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="lqhdidr1lEA=" DoubleValue="1341.46341463414637474"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="V6J2JWpXlUA=" DoubleValue="1365.85365853658527158"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="V6J2JWpXlUA=" DoubleValue="1365.85365853658527158"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="GZyPwfm4lUA=" DoubleValue="1390.24390243902439579"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="GZyPwfm4lUA=" DoubleValue="1390.24390243902439579"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="25WoXYkalkA=" DoubleValue="1414.63414634146352000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="25WoXYkalkA=" DoubleValue="1414.63414634146352000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="nI/B+Rh8lkA=" DoubleValue="1439.02439024390241684"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="nI/B+Rh8lkA=" DoubleValue="1439.02439024390241684"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="XonalajdlkA=" DoubleValue="1463.41463414634154105"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="XonalajdlkA=" DoubleValue="1463.41463414634154105"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="H4PzMTg/l0A=" DoubleValue="1487.80487804878043789"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="H4PzMTg/l0A=" DoubleValue="1487.80487804878043789"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="4XwMzsegl0A=" DoubleValue="1512.19512195121956211"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="4XwMzsegl0A=" DoubleValue="1512.19512195121956211"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="onYlalcCmEA=" DoubleValue="1536.58536585365845895"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="onYlalcCmEA=" DoubleValue="1536.58536585365845895"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="ZHA+BudjmEA=" DoubleValue="1560.97560975609758316"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="ZHA+BudjmEA=" DoubleValue="1560.97560975609758316"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="JWpXonbFmEA=" DoubleValue="1585.36585365853648000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="JWpXonbFmEA=" DoubleValue="1585.36585365853648000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="52NwPgYnmUA=" DoubleValue="1609.75609756097560421"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="52NwPgYnmUA=" DoubleValue="1609.75609756097560421"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="qV2J2pWImUA=" DoubleValue="1634.14634146341472842"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="qV2J2pWImUA=" DoubleValue="1634.14634146341472842"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="aleidiXqmUA=" DoubleValue="1658.53658536585362526"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="aleidiXqmUA=" DoubleValue="1658.53658536585362526"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="LFG7ErVLmkA=" DoubleValue="1682.92682926829274948"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="LFG7ErVLmkA=" DoubleValue="1682.92682926829274948"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="7UrUrkStmkA=" DoubleValue="1707.31707317073164631"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="7UrUrkStmkA=" DoubleValue="1707.31707317073164631"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="r0TtStQOm0A=" DoubleValue="1731.70731707317077053"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="r0TtStQOm0A=" DoubleValue="1731.70731707317077053"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="cD4G52Nwm0A=" DoubleValue="1756.09756097560966737"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="cD4G52Nwm0A=" DoubleValue="1756.09756097560966737"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="Mjgfg/PRm0A=" DoubleValue="1780.48780487804879158"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="Mjgfg/PRm0A=" DoubleValue="1780.48780487804879158"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="9DE4H4MznEA=" DoubleValue="1804.87804878048791579"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="9DE4H4MznEA=" DoubleValue="1804.87804878048791579"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="tStRuxKVnEA=" DoubleValue="1829.26829268292681263"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="tStRuxKVnEA=" DoubleValue="1829.26829268292681263"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="dyVqV6L2nEA=" DoubleValue="1853.65853658536593684"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="dyVqV6L2nEA=" DoubleValue="1853.65853658536593684"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="OB+D8zFYnUA=" DoubleValue="1878.04878048780483368"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="OB+D8zFYnUA=" DoubleValue="1878.04878048780483368"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="+hicj8G5nUA=" DoubleValue="1902.43902439024395790"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="+hicj8G5nUA=" DoubleValue="1902.43902439024395790"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="uxK1K1EbnkA=" DoubleValue="1926.82926829268285474"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="uxK1K1EbnkA=" DoubleValue="1926.82926829268285474"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="fQzOx+B8nkA=" DoubleValue="1951.21951219512197895"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="fQzOx+B8nkA=" DoubleValue="1951.21951219512197895"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="PgbnY3DenkA=" DoubleValue="1975.60975609756087579"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="PgbnY3DenkA=" DoubleValue="1975.60975609756087579"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="AAAAAABAn0A=" DoubleValue="2000.00000000000000000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="AAAAAABAn0A=" DoubleValue="2000.00000000000000000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="wvkYnI+hn0A=" DoubleValue="2024.39024390243912421"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="wvkYnI+hn0A=" DoubleValue="2024.39024390243912421"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="wvkYnI8BoEA=" DoubleValue="2048.78048780487824843"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="wvkYnI8BoEA=" DoubleValue="2048.78048780487824843"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="onYlalcyoEA=" DoubleValue="2073.17073170731691789"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="onYlalcyoEA=" DoubleValue="2073.17073170731691789"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="g/MxOB9joEA=" DoubleValue="2097.56097560975604210"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="g/MxOB9joEA=" DoubleValue="2097.56097560975604210"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="ZHA+BueToEA=" DoubleValue="2121.95121951219516632"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="ZHA+BueToEA=" DoubleValue="2121.95121951219516632"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="Re1K1K7EoEA=" DoubleValue="2146.34146341463429053"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="Re1K1K7EoEA=" DoubleValue="2146.34146341463429053"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="JWpXonb1oEA=" DoubleValue="2170.73170731707296000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="JWpXonb1oEA=" DoubleValue="2170.73170731707296000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="BudjcD4moUA=" DoubleValue="2195.12195121951208421"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="BudjcD4moUA=" DoubleValue="2195.12195121951208421"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="52NwPgZXoUA=" DoubleValue="2219.51219512195120842"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="52NwPgZXoUA=" DoubleValue="2219.51219512195120842"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="yOB8DM6HoUA=" DoubleValue="2243.90243902439033263"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="yOB8DM6HoUA=" DoubleValue="2243.90243902439033263"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="qV2J2pW4oUA=" DoubleValue="2268.29268292682945685"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="qV2J2pW4oUA=" DoubleValue="2268.29268292682945685"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="idqVqF3poUA=" DoubleValue="2292.68292682926812631"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="idqVqF3poUA=" DoubleValue="2292.68292682926812631"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="aleidiUaokA=" DoubleValue="2317.07317073170725052"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="aleidiUaokA=" DoubleValue="2317.07317073170725052"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="S9SuRO1KokA=" DoubleValue="2341.46341463414637474"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="S9SuRO1KokA=" DoubleValue="2341.46341463414637474"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="LFG7ErV7okA=" DoubleValue="2365.85365853658549895"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="LFG7ErV7okA=" DoubleValue="2365.85365853658549895"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="DM7H4HysokA=" DoubleValue="2390.24390243902416842"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="DM7H4HysokA=" DoubleValue="2390.24390243902416842"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.701.1.0" Value="7UrUrkTdokA=" DoubleValue="2414.63414634146329263"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.701.1.0" Value="7UrUrkTdokA=" DoubleValue="2414.63414634146329263"/>
+ <dxl:UpperBound Closed="true" TypeMdid="0.701.1.0" Value="zsfgfAwOo0A=" DoubleValue="2439.02439024390241684"/>
+ </dxl:StatsBucket>
+ </dxl:ColumnStatistics>
+ <dxl:RelationExtendedStatistics Mdid="10.17325.1.0" Name="optimize_min_max_aggregates"/>
+ </dxl:Metadata>
+ <dxl:Query>
+ <dxl:OutputColumns>
+ <dxl:Ident ColId="12" ColName="max" TypeMdid="0.25.1.0"/>
+ </dxl:OutputColumns>
+ <dxl:CTEList/>
+ <dxl:LogicalGroupBy>
+ <dxl:GroupingColumns/>
+ <dxl:ProjList>
+ <dxl:ProjElem ColId="12" Alias="max">
+ <dxl:AggFunc AggMdid="0.2129.1.0" AggDistinct="false" AggStage="Normal" AggKind="n" AggArgTypes="25">
+ <dxl:ValuesList ParamType="aggargs">
+ <dxl:Ident ColId="2" ColName="b" TypeMdid="0.25.1.0"/>
+ </dxl:ValuesList>
+ <dxl:ValuesList ParamType="aggdirectargs"/>
+ <dxl:ValuesList ParamType="aggorder"/>
+ <dxl:ValuesList ParamType="aggdistinct"/>
+ </dxl:AggFunc>
+ </dxl:ProjElem>
+ </dxl:ProjList>
+ <dxl:LogicalGet>
+ <dxl:TableDescriptor Mdid="6.17325.1.0" TableName="optimize_min_max_aggregates" LockMode="1" AclMode="2">
+ <dxl:Columns>
+ <dxl:Column ColId="1" Attno="1" ColName="a" TypeMdid="0.23.1.0" ColWidth="4"/>
+ <dxl:Column ColId="2" Attno="2" ColName="b" TypeMdid="0.25.1.0" ColWidth="9"/>
+ <dxl:Column ColId="3" Attno="3" ColName="c" TypeMdid="0.701.1.0" ColWidth="8"/>
+ <dxl:Column ColId="4" Attno="4" ColName="d" TypeMdid="0.23.1.0" ColWidth="4"/>
+ <dxl:Column ColId="5" Attno="-1" ColName="ctid" TypeMdid="0.27.1.0" ColWidth="6"/>
+ <dxl:Column ColId="6" Attno="-2" ColName="xmin" TypeMdid="0.28.1.0" ColWidth="4"/>
+ <dxl:Column ColId="7" Attno="-3" ColName="cmin" TypeMdid="0.29.1.0" ColWidth="4"/>
+ <dxl:Column ColId="8" Attno="-4" ColName="xmax" TypeMdid="0.28.1.0" ColWidth="4"/>
+ <dxl:Column ColId="9" Attno="-5" ColName="cmax" TypeMdid="0.29.1.0" ColWidth="4"/>
+ <dxl:Column ColId="10" Attno="-6" ColName="tableoid" TypeMdid="0.26.1.0" ColWidth="4"/>
+ <dxl:Column ColId="11" Attno="-7" ColName="gp_segment_id" TypeMdid="0.23.1.0" ColWidth="4"/>
+ </dxl:Columns>
+ </dxl:TableDescriptor>
+ </dxl:LogicalGet>
+ </dxl:LogicalGroupBy>
+ </dxl:Query>
+ <dxl:Plan Id="0" SpaceSize="7">
+ <dxl:Aggregate AggregationStrategy="Plain" StreamSafe="false">
+ <dxl:Properties>
+ <dxl:Cost StartupCost="0" TotalCost="7.826857" Rows="1.000000" Width="8"/>
+ </dxl:Properties>
+ <dxl:GroupingColumns/>
+ <dxl:ProjList>
+ <dxl:ProjElem ColId="11" Alias="max">
+ <dxl:AggFunc AggMdid="0.2129.1.0" AggDistinct="false" AggStage="Normal" AggKind="n" AggArgTypes="25">
+ <dxl:ValuesList ParamType="aggargs">
+ <dxl:Ident ColId="1" ColName="b" TypeMdid="0.25.1.0"/>
+ </dxl:ValuesList>
+ <dxl:ValuesList ParamType="aggdirectargs"/>
+ <dxl:ValuesList ParamType="aggorder"/>
+ <dxl:ValuesList ParamType="aggdistinct"/>
+ </dxl:AggFunc>
+ </dxl:ProjElem>
+ </dxl:ProjList>
+ <dxl:Filter/>
+ <dxl:Limit>
+ <dxl:Properties>
+ <dxl:Cost StartupCost="0" TotalCost="7.826856" Rows="1.000000" Width="9"/>
+ </dxl:Properties>
+ <dxl:ProjList>
+ <dxl:ProjElem ColId="1" Alias="b">
+ <dxl:Ident ColId="1" ColName="b" TypeMdid="0.25.1.0"/>
+ </dxl:ProjElem>
+ </dxl:ProjList>
+ <dxl:GatherMotion InputSegments="0,1,2" OutputSegments="-1">
+ <dxl:Properties>
+ <dxl:Cost StartupCost="0" TotalCost="7.826847" Rows="1.000000" Width="9"/>
+ </dxl:Properties>
+ <dxl:ProjList>
+ <dxl:ProjElem ColId="1" Alias="b">
+ <dxl:Ident ColId="1" ColName="b" TypeMdid="0.25.1.0"/>
+ </dxl:ProjElem>
+ </dxl:ProjList>
+ <dxl:Filter/>
+ <dxl:SortingColumnList>
+ <dxl:SortingColumn ColId="1" SortOperatorMdid="0.666.1.0" SortOperatorName=">" SortNullsFirst="true"/>
+ </dxl:SortingColumnList>
+ <dxl:Limit>
+ <dxl:Properties>
+ <dxl:Cost StartupCost="0" TotalCost="7.826813" Rows="1.000000" Width="9"/>
+ </dxl:Properties>
+ <dxl:ProjList>
+ <dxl:ProjElem ColId="1" Alias="b">
+ <dxl:Ident ColId="1" ColName="b" TypeMdid="0.25.1.0"/>
+ </dxl:ProjElem>
+ </dxl:ProjList>
+ <dxl:IndexScan IndexScanDirection="Backward">
+ <dxl:Properties>
+ <dxl:Cost StartupCost="0" TotalCost="7.771010" Rows="10000.000000" Width="9"/>
+ </dxl:Properties>
+ <dxl:ProjList>
+ <dxl:ProjElem ColId="1" Alias="b">
+ <dxl:Ident ColId="1" ColName="b" TypeMdid="0.25.1.0"/>
+ </dxl:ProjElem>
+ </dxl:ProjList>
+ <dxl:Filter/>
+ <dxl:IndexCondList>
+ <dxl:Not>
+ <dxl:IsNull>
+ <dxl:Ident ColId="1" ColName="b" TypeMdid="0.25.1.0"/>
+ </dxl:IsNull>
+ </dxl:Not>
+ </dxl:IndexCondList>
+ <dxl:Partitions/>
+ <dxl:IndexDescriptor Mdid="7.17330.1.0" IndexName="index_bc"/>
+ <dxl:TableDescriptor Mdid="6.17325.1.0" TableName="optimize_min_max_aggregates" LockMode="1" AclMode="2">
+ <dxl:Columns>
+ <dxl:Column ColId="0" Attno="1" ColName="a" TypeMdid="0.23.1.0" ColWidth="4"/>
+ <dxl:Column ColId="1" Attno="2" ColName="b" TypeMdid="0.25.1.0" ColWidth="9"/>
+ <dxl:Column ColId="4" Attno="-1" ColName="ctid" TypeMdid="0.27.1.0" ColWidth="6"/>
+ <dxl:Column ColId="5" Attno="-2" ColName="xmin" TypeMdid="0.28.1.0" ColWidth="4"/>
+ <dxl:Column ColId="6" Attno="-3" ColName="cmin" TypeMdid="0.29.1.0" ColWidth="4"/>
+ <dxl:Column ColId="7" Attno="-4" ColName="xmax" TypeMdid="0.28.1.0" ColWidth="4"/>
+ <dxl:Column ColId="8" Attno="-5" ColName="cmax" TypeMdid="0.29.1.0" ColWidth="4"/>
+ <dxl:Column ColId="9" Attno="-6" ColName="tableoid" TypeMdid="0.26.1.0" ColWidth="4"/>
+ <dxl:Column ColId="10" Attno="-7" ColName="gp_segment_id" TypeMdid="0.23.1.0" ColWidth="4"/>
+ </dxl:Columns>
+ </dxl:TableDescriptor>
+ </dxl:IndexScan>
+ <dxl:LimitCount>
+ <dxl:ConstValue TypeMdid="0.20.1.0" Value="1"/>
+ </dxl:LimitCount>
+ <dxl:LimitOffset>
+ <dxl:ConstValue TypeMdid="0.20.1.0" Value="0"/>
+ </dxl:LimitOffset>
+ </dxl:Limit>
+ </dxl:GatherMotion>
+ <dxl:LimitCount>
+ <dxl:ConstValue TypeMdid="0.20.1.0" Value="1"/>
+ </dxl:LimitCount>
+ <dxl:LimitOffset>
+ <dxl:ConstValue TypeMdid="0.20.1.0" Value="0"/>
+ </dxl:LimitOffset>
+ </dxl:Limit>
+ </dxl:Aggregate>
+ </dxl:Plan>
+ </dxl:Thread>
+</dxl:DXLMessage>
diff --git a/src/backend/gporca/data/dxl/minidump/Min-Aggregate-uses-IndexScan-and-Limit.mdp b/src/backend/gporca/data/dxl/minidump/Min-Aggregate-uses-IndexScan-and-Limit.mdp
new file mode 100644
index 0000000000..7639558e42
--- /dev/null
+++ b/src/backend/gporca/data/dxl/minidump/Min-Aggregate-uses-IndexScan-and-Limit.mdp
@@ -0,0 +1,1199 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<dxl:DXLMessage xmlns:dxl="http://greenplum.com/dxl/2010/12/">
+<dxl:Comment><![CDATA[
+
+ Objective of this test is to ensure if min() aggregate on an btree index column is optimized
+ to use a plan with IndexScan and Limit.
+
+ create table optimize_min_max_aggregates(a int, b text, c float, d int);
+ create index index_d on optimize_min_max_aggregates using btree(d);
+ insert into optimize_min_max_aggregates select i, concat('col_b', i), i/4.1, i*2 from generate_series(1,10000)i;
+ analyze optimize_min_max_aggregates;
+
+ Query: explain select min(d) from optimize_min_max_aggregates;
+
+ Plan:
+ QUERY PLAN
+
+ Aggregate (cost=0.00..7.25 rows=1 width=4)
+ -> Limit (cost=0.00..7.25 rows=1 width=4)
+ -> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..7.25 rows=1 width=4)
+ Merge Key: d
+ -> Limit (cost=0.00..7.25 rows=1 width=4)
+ -> Index Scan using index_d on optimize_min_max_aggregates (cost=0.00..7.22 rows=3334 width=4)
+ Index Cond: (d IS NOT NULL)
+ Optimizer: GPORCA
+ (8 rows)
+ ]]>
+ </dxl:Comment>
+ <dxl:Thread Id="0">
+ <dxl:OptimizerConfig>
+ <dxl:EnumeratorConfig Id="0" PlanSamples="0" CostThreshold="0"/>
+ <dxl:StatisticsConfig DampingFactorFilter="0.750000" DampingFactorJoin="0.000000" DampingFactorGroupBy="0.750000" MaxStatsBuckets="100"/>
+ <dxl:CTEConfig CTEInliningCutoff="0"/>
+ <dxl:WindowOids RowNumber="3100" Rank="3101"/>
+ <dxl:CostModelConfig CostModelType="1" SegmentsForCosting="3">
+ <dxl:CostParams>
+ <dxl:CostParam Name="NLJFactor" Value="1024.000000" LowerBound="1023.500000" UpperBound="1024.500000"/>
+ </dxl:CostParams>
+ </dxl:CostModelConfig>
+ <dxl:Hint JoinArityForAssociativityCommutativity="18" ArrayExpansionThreshold="20" JoinOrderDynamicProgThreshold="10" BroadcastThreshold="100000" EnforceConstraintsOnDML="false" PushGroupByBelowSetopThreshold="10" XformBindThreshold="0" SkewFactor="0"/>
+ <dxl:TraceFlags Value="102001,102002,102003,102043,102074,102120,102144,102162,102163,103001,103014,103022,103026,103027,103029,103033,103038,103040,104002,104003,104004,104005,105000,106000"/>
+ </dxl:OptimizerConfig>
+ <dxl:Metadata SystemIds="0.GPDB">
+ <dxl:Type Mdid="0.16.1.0" Name="bool" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="1" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.2222.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7124.1.0"/>
+ <dxl:PartOpfamily Mdid="0.424.1.0"/>
+ <dxl:EqualityOp Mdid="0.91.1.0"/>
+ <dxl:InequalityOp Mdid="0.85.1.0"/>
+ <dxl:LessThanOp Mdid="0.58.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.1694.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.59.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.1695.1.0"/>
+ <dxl:ComparisonOp Mdid="0.1693.1.0"/>
+ <dxl:ArrayType Mdid="0.1000.1.0"/>
+ <dxl:MinAgg Mdid="0.0.0.0"/>
+ <dxl:MaxAgg Mdid="0.0.0.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.20.1.0" Name="Int8" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="8" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.1977.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7100.1.0"/>
+ <dxl:PartOpfamily Mdid="0.1976.1.0"/>
+ <dxl:EqualityOp Mdid="0.410.1.0"/>
+ <dxl:InequalityOp Mdid="0.411.1.0"/>
+ <dxl:LessThanOp Mdid="0.412.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.414.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.413.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.415.1.0"/>
+ <dxl:ComparisonOp Mdid="0.351.1.0"/>
+ <dxl:ArrayType Mdid="0.1016.1.0"/>
+ <dxl:MinAgg Mdid="0.2131.1.0"/>
+ <dxl:MaxAgg Mdid="0.2115.1.0"/>
+ <dxl:AvgAgg Mdid="0.2100.1.0"/>
+ <dxl:SumAgg Mdid="0.2107.1.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.23.1.0" Name="int4" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="4" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.1977.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7100.1.0"/>
+ <dxl:PartOpfamily Mdid="0.1976.1.0"/>
+ <dxl:EqualityOp Mdid="0.96.1.0"/>
+ <dxl:InequalityOp Mdid="0.518.1.0"/>
+ <dxl:LessThanOp Mdid="0.97.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.523.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.521.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.525.1.0"/>
+ <dxl:ComparisonOp Mdid="0.351.1.0"/>
+ <dxl:ArrayType Mdid="0.1007.1.0"/>
+ <dxl:MinAgg Mdid="0.2132.1.0"/>
+ <dxl:MaxAgg Mdid="0.2116.1.0"/>
+ <dxl:AvgAgg Mdid="0.2101.1.0"/>
+ <dxl:SumAgg Mdid="0.2108.1.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.25.1.0" Name="text" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="true" IsFixedLength="false" Length="-1" PassByValue="false">
+ <dxl:DistrOpfamily Mdid="0.1995.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7105.1.0"/>
+ <dxl:PartOpfamily Mdid="0.1994.1.0"/>
+ <dxl:EqualityOp Mdid="0.98.1.0"/>
+ <dxl:InequalityOp Mdid="0.531.1.0"/>
+ <dxl:LessThanOp Mdid="0.664.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.665.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.666.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.667.1.0"/>
+ <dxl:ComparisonOp Mdid="0.360.1.0"/>
+ <dxl:ArrayType Mdid="0.1009.1.0"/>
+ <dxl:MinAgg Mdid="0.2145.1.0"/>
+ <dxl:MaxAgg Mdid="0.2129.1.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:ColumnStatistics Mdid="1.21124.1.0.3" Name="d" Width="4.000000" NullFreq="0.000000" NdvRemain="0.000000" FreqRemain="0.000000" ColStatsMissing="false">
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="10000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="10000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="10200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="10200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="10400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="10400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="10600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="10600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="10800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="10800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="11000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="11000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="11200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="11200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="11400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="11400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="11600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="11600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="11800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="11800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="12000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="12000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="12200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="12200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="12400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="12400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="12600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="12600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="12800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="12800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="13000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="13000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="13200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="13200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="13400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="13400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="13600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="13600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="13800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="13800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="14000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="14000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="14200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="14200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="14400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="14400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="14600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="14600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="14800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="14800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="15000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="15000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="15200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="15200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="15400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="15400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="15600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="15600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="15800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="15800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="16000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="16000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="16200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="16200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="16400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="16400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="16600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="16600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="16800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="16800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="17000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="17000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="17200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="17200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="17400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="17400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="17600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="17600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="17800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="17800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="18000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="18000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="18200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="18200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="18400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="18400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="18600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="18600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="18800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="18800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="19000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="19000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="19200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="19200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="19400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="19400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="19600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="19600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="19800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="19800"/>
+ <dxl:UpperBound Closed="true" TypeMdid="0.23.1.0" Value="20000"/>
+ </dxl:StatsBucket>
+ </dxl:ColumnStatistics>
+ <dxl:Type Mdid="0.26.1.0" Name="oid" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="4" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.1990.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7109.1.0"/>
+ <dxl:PartOpfamily Mdid="0.1989.1.0"/>
+ <dxl:EqualityOp Mdid="0.607.1.0"/>
+ <dxl:InequalityOp Mdid="0.608.1.0"/>
+ <dxl:LessThanOp Mdid="0.609.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.611.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.610.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.612.1.0"/>
+ <dxl:ComparisonOp Mdid="0.356.1.0"/>
+ <dxl:ArrayType Mdid="0.1028.1.0"/>
+ <dxl:MinAgg Mdid="0.2134.1.0"/>
+ <dxl:MaxAgg Mdid="0.2118.1.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.27.1.0" Name="tid" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="6" PassByValue="false">
+ <dxl:DistrOpfamily Mdid="0.2227.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7110.1.0"/>
+ <dxl:PartOpfamily Mdid="0.2789.1.0"/>
+ <dxl:EqualityOp Mdid="0.387.1.0"/>
+ <dxl:InequalityOp Mdid="0.402.1.0"/>
+ <dxl:LessThanOp Mdid="0.2799.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.2801.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.2800.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.2802.1.0"/>
+ <dxl:ComparisonOp Mdid="0.2794.1.0"/>
+ <dxl:ArrayType Mdid="0.1010.1.0"/>
+ <dxl:MinAgg Mdid="0.2798.1.0"/>
+ <dxl:MaxAgg Mdid="0.2797.1.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.29.1.0" Name="cid" IsRedistributable="true" IsHashable="true" IsMergeJoinable="false" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="4" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.2226.1.0"/>
+ <dxl:EqualityOp Mdid="0.385.1.0"/>
+ <dxl:InequalityOp Mdid="0.0.0.0"/>
+ <dxl:LessThanOp Mdid="0.0.0.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.0.0.0"/>
+ <dxl:GreaterThanOp Mdid="0.0.0.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.0.0.0"/>
+ <dxl:ComparisonOp Mdid="0.0.0.0"/>
+ <dxl:ArrayType Mdid="0.1012.1.0"/>
+ <dxl:MinAgg Mdid="0.0.0.0"/>
+ <dxl:MaxAgg Mdid="0.0.0.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Type Mdid="0.28.1.0" Name="xid" IsRedistributable="true" IsHashable="true" IsMergeJoinable="false" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="4" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.2225.1.0"/>
+ <dxl:EqualityOp Mdid="0.352.1.0"/>
+ <dxl:InequalityOp Mdid="0.3315.1.0"/>
+ <dxl:LessThanOp Mdid="0.0.0.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.0.0.0"/>
+ <dxl:GreaterThanOp Mdid="0.0.0.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.0.0.0"/>
+ <dxl:ComparisonOp Mdid="0.0.0.0"/>
+ <dxl:ArrayType Mdid="0.1011.1.0"/>
+ <dxl:MinAgg Mdid="0.0.0.0"/>
+ <dxl:MaxAgg Mdid="0.0.0.0"/>
+ <dxl:AvgAgg Mdid="0.0.0.0"/>
+ <dxl:SumAgg Mdid="0.0.0.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:Index Mdid="7.21130.1.0" Name="index_d" IsClustered="false" AmCanOrder="true" IndexType="B-tree" IndexItemType="0.2283.1.0" KeyColumns="3" IncludedColumns="" ReturnableColumns="3" SortDirection="ASC" NullsDirection="LAST">
+ <dxl:Opfamilies>
+ <dxl:Opfamily Mdid="0.1976.1.0"/>
+ </dxl:Opfamilies>
+ </dxl:Index>
+ <dxl:Index Mdid="7.21129.1.0" Name="index_bc" IsClustered="false" AmCanOrder="true" IndexType="B-tree" IndexItemType="0.2283.1.0" KeyColumns="1,2" IncludedColumns="" ReturnableColumns="1,2" SortDirection="ASC,ASC" NullsDirection="LAST,LAST">
+ <dxl:Opfamilies>
+ <dxl:Opfamily Mdid="0.1994.1.0"/>
+ <dxl:Opfamily Mdid="0.1970.1.0"/>
+ </dxl:Opfamilies>
+ </dxl:Index>
+ <dxl:RelationStatistics Mdid="2.21124.1.0" Name="optimize_min_max_aggregates" Rows="10000.000000" RelPages="20" RelAllVisible="0" EmptyRelation="false"/>
+ <dxl:Relation Mdid="6.21124.1.0" Name="optimize_min_max_aggregates" IsTemporary="false" StorageType="Heap" DistributionPolicy="Hash" DistributionColumns="0" Keys="10,4">
+ <dxl:Columns>
+ <dxl:Column Name="a" Attno="1" Mdid="0.23.1.0" Nullable="true" ColWidth="4"/>
+ <dxl:Column Name="b" Attno="2" Mdid="0.25.1.0" Nullable="true" ColWidth="9"/>
+ <dxl:Column Name="c" Attno="3" Mdid="0.701.1.0" Nullable="true" ColWidth="8"/>
+ <dxl:Column Name="d" Attno="4" Mdid="0.23.1.0" Nullable="true" ColWidth="4"/>
+ <dxl:Column Name="ctid" Attno="-1" Mdid="0.27.1.0" Nullable="false" ColWidth="6"/>
+ <dxl:Column Name="xmin" Attno="-2" Mdid="0.28.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="cmin" Attno="-3" Mdid="0.29.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="xmax" Attno="-4" Mdid="0.28.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="cmax" Attno="-5" Mdid="0.29.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="tableoid" Attno="-6" Mdid="0.26.1.0" Nullable="false" ColWidth="4"/>
+ <dxl:Column Name="gp_segment_id" Attno="-7" Mdid="0.23.1.0" Nullable="false" ColWidth="4"/>
+ </dxl:Columns>
+ <dxl:IndexInfoList>
+ <dxl:IndexInfo Mdid="7.21129.1.0" IsPartial="false"/>
+ <dxl:IndexInfo Mdid="7.21130.1.0" IsPartial="false"/>
+ </dxl:IndexInfoList>
+ <dxl:CheckConstraints/>
+ <dxl:DistrOpfamilies>
+ <dxl:DistrOpfamily Mdid="0.1977.1.0"/>
+ </dxl:DistrOpfamilies>
+ </dxl:Relation>
+ <dxl:ColumnStatistics Mdid="1.21124.1.0.0" Name="a" Width="4.000000" NullFreq="0.000000" NdvRemain="0.000000" FreqRemain="0.000000" ColStatsMissing="false">
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="900"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="1900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="1900"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="2900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="2900"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="3900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="3900"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="4900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="4900"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="5900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="5900"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="6900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="6900"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="7900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="7900"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="8900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="8900"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9000"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9000"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9100"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9100"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9200"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9200"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9300"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9300"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9400"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9400"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9500"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9500"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9600"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9600"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9700"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9700"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9800"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9800"/>
+ <dxl:UpperBound Closed="false" TypeMdid="0.23.1.0" Value="9900"/>
+ </dxl:StatsBucket>
+ <dxl:StatsBucket Frequency="0.010000" DistinctValues="100.000000">
+ <dxl:LowerBound Closed="true" TypeMdid="0.23.1.0" Value="9900"/>
+ <dxl:UpperBound Closed="true" TypeMdid="0.23.1.0" Value="10000"/>
+ </dxl:StatsBucket>
+ </dxl:ColumnStatistics>
+ <dxl:Type Mdid="0.701.1.0" Name="float8" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="8" PassByValue="true">
+ <dxl:DistrOpfamily Mdid="0.1971.1.0"/>
+ <dxl:LegacyDistrOpfamily Mdid="0.7102.1.0"/>
+ <dxl:PartOpfamily Mdid="0.1970.1.0"/>
+ <dxl:EqualityOp Mdid="0.670.1.0"/>
+ <dxl:InequalityOp Mdid="0.671.1.0"/>
+ <dxl:LessThanOp Mdid="0.672.1.0"/>
+ <dxl:LessThanEqualsOp Mdid="0.673.1.0"/>
+ <dxl:GreaterThanOp Mdid="0.674.1.0"/>
+ <dxl:GreaterThanEqualsOp Mdid="0.675.1.0"/>
+ <dxl:ComparisonOp Mdid="0.355.1.0"/>
+ <dxl:ArrayType Mdid="0.1022.1.0"/>
+ <dxl:MinAgg Mdid="0.2136.1.0"/>
+ <dxl:MaxAgg Mdid="0.2120.1.0"/>
+ <dxl:AvgAgg Mdid="0.2105.1.0"/>
+ <dxl:SumAgg Mdid="0.2111.1.0"/>
+ <dxl:CountAgg Mdid="0.2147.1.0"/>
+ </dxl:Type>
+ <dxl:GPDBAgg Mdid="0.2132.1.0" Name="min" IsRepSafe="true" IsSplittable="true" HashAggCapable="true">
+ <dxl:ResultType Mdid="0.23.1.0"/>
+ <dxl:IntermediateResultType Mdid="0.23.1.0"/>
+ </dxl:GPDBAgg>
+ <dxl:RelationExtendedStatistics Mdid="10.21124.1.0" Name="optimize_min_max_aggregates"/>
+ <dxl:GPDBScalarOp Mdid="0.97.1.0" Name="<" ComparisonType="LT" ReturnsNullOnNullInput="true" IsNDVPreserving="false">
+ <dxl:LeftType Mdid="0.23.1.0"/>
+ <dxl:RightType Mdid="0.23.1.0"/>
+ <dxl:ResultType Mdid="0.16.1.0"/>
+ <dxl:OpFunc Mdid="0.66.1.0"/>
+ <dxl:Commutator Mdid="0.521.1.0"/>
+ <dxl:InverseOp Mdid="0.525.1.0"/>
+ <dxl:Opfamilies>
+ <dxl:Opfamily Mdid="0.1976.1.0"/>
+ <dxl:Opfamily Mdid="0.4054.1.0"/>
+ <dxl:Opfamily Mdid="0.10009.1.0"/>
+ </dxl:Opfamilies>
+ </dxl:GPDBScalarOp>
+ </dxl:Metadata>
+ <dxl:Query>
+ <dxl:OutputColumns>
+ <dxl:Ident ColId="12" ColName="min" TypeMdid="0.23.1.0"/>
+ </dxl:OutputColumns>
+ <dxl:CTEList/>
+ <dxl:LogicalGroupBy>
+ <dxl:GroupingColumns/>
+ <dxl:ProjList>
+ <dxl:ProjElem ColId="12" Alias="min">
+ <dxl:AggFunc AggMdid="0.2132.1.0" AggDistinct="false" AggStage="Normal" AggKind="n" AggArgTypes="23">
+ <dxl:ValuesList ParamType="aggargs">
+ <dxl:Ident ColId="4" ColName="d" TypeMdid="0.23.1.0"/>
+ </dxl:ValuesList>
+ <dxl:ValuesList ParamType="aggdirectargs"/>
+ <dxl:ValuesList ParamType="aggorder"/>
+ <dxl:ValuesList ParamType="aggdistinct"/>
+ </dxl:AggFunc>
+ </dxl:ProjElem>
+ </dxl:ProjList>
+ <dxl:LogicalGet>
+ <dxl:TableDescriptor Mdid="6.21124.1.0" TableName="optimize_min_max_aggregates" LockMode="1" AclMode="2">
+ <dxl:Columns>
+ <dxl:Column ColId="1" Attno="1" ColName="a" TypeMdid="0.23.1.0" ColWidth="4"/>
+ <dxl:Column ColId="2" Attno="2" ColName="b" TypeMdid="0.25.1.0" ColWidth="9"/>
+ <dxl:Column ColId="3" Attno="3" ColName="c" TypeMdid="0.701.1.0" ColWidth="8"/>
+ <dxl:Column ColId="4" Attno="4" ColName="d" TypeMdid="0.23.1.0" ColWidth="4"/>
+ <dxl:Column ColId="5" Attno="-1" ColName="ctid" TypeMdid="0.27.1.0" ColWidth="6"/>
+ <dxl:Column ColId="6" Attno="-2" ColName="xmin" TypeMdid="0.28.1.0" ColWidth="4"/>
+ <dxl:Column ColId="7" Attno="-3" ColName="cmin" TypeMdid="0.29.1.0" ColWidth="4"/>
+ <dxl:Column ColId="8" Attno="-4" ColName="xmax" TypeMdid="0.28.1.0" ColWidth="4"/>
+ <dxl:Column ColId="9" Attno="-5" ColName="cmax" TypeMdid="0.29.1.0" ColWidth="4"/>
+ <dxl:Column ColId="10" Attno="-6" ColName="tableoid" TypeMdid="0.26.1.0" ColWidth="4"/>
+ <dxl:Column ColId="11" Attno="-7" ColName="gp_segment_id" TypeMdid="0.23.1.0" ColWidth="4"/>
+ </dxl:Columns>
+ </dxl:TableDescriptor>
+ </dxl:LogicalGet>
+ </dxl:LogicalGroupBy>
+ </dxl:Query>
+ <dxl:Plan Id="0" SpaceSize="7">
+ <dxl:Aggregate AggregationStrategy="Plain" StreamSafe="false">
+ <dxl:Properties>
+ <dxl:Cost StartupCost="0" TotalCost="7.245821" Rows="1.000000" Width="4"/>
+ </dxl:Properties>
+ <dxl:GroupingColumns/>
+ <dxl:ProjList>
+ <dxl:ProjElem ColId="11" Alias="min">
+ <dxl:AggFunc AggMdid="0.2132.1.0" AggDistinct="false" AggStage="Normal" AggKind="n" AggArgTypes="23">
+ <dxl:ValuesList ParamType="aggargs">
+ <dxl:Ident ColId="3" ColName="d" TypeMdid="0.23.1.0"/>
+ </dxl:ValuesList>
+ <dxl:ValuesList ParamType="aggdirectargs"/>
+ <dxl:ValuesList ParamType="aggorder"/>
+ <dxl:ValuesList ParamType="aggdistinct"/>
+ </dxl:AggFunc>
+ </dxl:ProjElem>
+ </dxl:ProjList>
+ <dxl:Filter/>
+ <dxl:Limit>
+ <dxl:Properties>
+ <dxl:Cost StartupCost="0" TotalCost="7.245820" Rows="1.000000" Width="4"/>
+ </dxl:Properties>
+ <dxl:ProjList>
+ <dxl:ProjElem ColId="3" Alias="d">
+ <dxl:Ident ColId="3" ColName="d" TypeMdid="0.23.1.0"/>
+ </dxl:ProjElem>
+ </dxl:ProjList>
+ <dxl:GatherMotion InputSegments="0,1,2" OutputSegments="-1">
+ <dxl:Properties>
+ <dxl:Cost StartupCost="0" TotalCost="7.245816" Rows="1.000000" Width="4"/>
+ </dxl:Properties>
+ <dxl:ProjList>
+ <dxl:ProjElem ColId="3" Alias="d">
+ <dxl:Ident ColId="3" ColName="d" TypeMdid="0.23.1.0"/>
+ </dxl:ProjElem>
+ </dxl:ProjList>
+ <dxl:Filter/>
+ <dxl:SortingColumnList>
+ <dxl:SortingColumn ColId="3" SortOperatorMdid="0.97.1.0" SortOperatorName="<" SortNullsFirst="false"/>
+ </dxl:SortingColumnList>
+ <dxl:Limit>
+ <dxl:Properties>
+ <dxl:Cost StartupCost="0" TotalCost="7.245801" Rows="1.000000" Width="4"/>
+ </dxl:Properties>
+ <dxl:ProjList>
+ <dxl:ProjElem ColId="3" Alias="d">
+ <dxl:Ident ColId="3" ColName="d" TypeMdid="0.23.1.0"/>
+ </dxl:ProjElem>
+ </dxl:ProjList>
+ <dxl:IndexScan IndexScanDirection="Forward">
+ <dxl:Properties>
+ <dxl:Cost StartupCost="0" TotalCost="7.221000" Rows="10000.000000" Width="4"/>
+ </dxl:Properties>
+ <dxl:ProjList>
+ <dxl:ProjElem ColId="3" Alias="d">
+ <dxl:Ident ColId="3" ColName="d" TypeMdid="0.23.1.0"/>
+ </dxl:ProjElem>
+ </dxl:ProjList>
+ <dxl:Filter/>
+ <dxl:IndexCondList>
+ <dxl:Not>
+ <dxl:IsNull>
+ <dxl:Ident ColId="3" ColName="d" TypeMdid="0.23.1.0"/>
+ </dxl:IsNull>
+ </dxl:Not>
+ </dxl:IndexCondList>
+ <dxl:Partitions/>
+ <dxl:IndexDescriptor Mdid="7.21130.1.0" IndexName="index_d"/>
+ <dxl:TableDescriptor Mdid="6.21124.1.0" TableName="optimize_min_max_aggregates" LockMode="1" AclMode="2">
+ <dxl:Columns>
+ <dxl:Column ColId="0" Attno="1" ColName="a" TypeMdid="0.23.1.0" ColWidth="4"/>
+ <dxl:Column ColId="3" Attno="4" ColName="d" TypeMdid="0.23.1.0" ColWidth="4"/>
+ <dxl:Column ColId="4" Attno="-1" ColName="ctid" TypeMdid="0.27.1.0" ColWidth="6"/>
+ <dxl:Column ColId="5" Attno="-2" ColName="xmin" TypeMdid="0.28.1.0" ColWidth="4"/>
+ <dxl:Column ColId="6" Attno="-3" ColName="cmin" TypeMdid="0.29.1.0" ColWidth="4"/>
+ <dxl:Column ColId="7" Attno="-4" ColName="xmax" TypeMdid="0.28.1.0" ColWidth="4"/>
+ <dxl:Column ColId="8" Attno="-5" ColName="cmax" TypeMdid="0.29.1.0" ColWidth="4"/>
+ <dxl:Column ColId="9" Attno="-6" ColName="tableoid" TypeMdid="0.26.1.0" ColWidth="4"/>
+ <dxl:Column ColId="10" Attno="-7" ColName="gp_segment_id" TypeMdid="0.23.1.0" ColWidth="4"/>
+ </dxl:Columns>
+ </dxl:TableDescriptor>
+ </dxl:IndexScan>
+ <dxl:LimitCount>
+ <dxl:ConstValue TypeMdid="0.20.1.0" Value="1"/>
+ </dxl:LimitCount>
+ <dxl:LimitOffset>
+ <dxl:ConstValue TypeMdid="0.20.1.0" Value="0"/>
+ </dxl:LimitOffset>
+ </dxl:Limit>
+ </dxl:GatherMotion>
+ <dxl:LimitCount>
+ <dxl:ConstValue TypeMdid="0.20.1.0" Value="1"/>
+ </dxl:LimitCount>
+ <dxl:LimitOffset>
+ <dxl:ConstValue TypeMdid="0.20.1.0" Value="0"/>
+ </dxl:LimitOffset>
+ </dxl:Limit>
+ </dxl:Aggregate>
+ </dxl:Plan>
+ </dxl:Thread>
+</dxl:DXLMessage>
diff --git a/src/backend/gporca/libgpopt/include/gpopt/base/CUtils.h b/src/backend/gporca/libgpopt/include/gpopt/base/CUtils.h
index 3f01bf7ff4..a179544052 100644
--- a/src/backend/gporca/libgpopt/include/gpopt/base/CUtils.h
+++ b/src/backend/gporca/libgpopt/include/gpopt/base/CUtils.h
@@ -964,6 +964,13 @@ public:
static CExpression *PexprLimit(CMemoryPool *mp, CExpression *pexpr,
ULONG ulOffSet, ULONG count);
+ // generate a limit expression on top of the given relational child with given offset, limit count and OrderSpec
+ static CExpression *BuildLimitExprWithOrderSpec(CMemoryPool *mp,
+ CExpression *pexpr,
+ COrderSpec *pos,
+ ULONG ulOffSet,
+ ULONG count);
+
// return true if given expression contains window aggregate function
static BOOL FHasAggWindowFunc(CExpression *pexpr);
@@ -1012,6 +1019,8 @@ public:
static BOOL FScalarConstBoolNull(CExpression *pexpr);
static BOOL FScalarConstOrBinaryCoercible(CExpression *pexpr);
+
+ static BOOL FScalarIdentNullTest(CExpression *pexpr);
}; // class CUtils
// hash set from expressions
diff --git a/src/backend/gporca/libgpopt/include/gpopt/operators/CScalarProjectElement.h b/src/backend/gporca/libgpopt/include/gpopt/operators/CScalarProjectElement.h
index c4b04c6ceb..08ea86a19d 100644
--- a/src/backend/gporca/libgpopt/include/gpopt/operators/CScalarProjectElement.h
+++ b/src/backend/gporca/libgpopt/include/gpopt/operators/CScalarProjectElement.h
@@ -39,6 +39,10 @@ private:
public:
CScalarProjectElement(const CScalarProjectElement &) = delete;
+ CScalarProjectElement(CMemoryPool *mp) : CScalar(mp)
+ {
+ }
+
// ctor
CScalarProjectElement(CMemoryPool *mp, CColRef *colref)
: CScalar(mp), m_pcr(colref)
diff --git a/src/backend/gporca/libgpopt/include/gpopt/xforms/CXform.h b/src/backend/gporca/libgpopt/include/gpopt/xforms/CXform.h
index 84715b6b5f..e8eebdb942 100644
--- a/src/backend/gporca/libgpopt/include/gpopt/xforms/CXform.h
+++ b/src/backend/gporca/libgpopt/include/gpopt/xforms/CXform.h
@@ -229,6 +229,7 @@ public:
ExfPushJoinBelowRightUnionAll,
ExfLimit2IndexGet,
ExfDynamicIndexGet2DynamicIndexOnlyScan,
+ ExfMinMax2IndexGet,
ExfInvalid,
ExfSentinel = ExfInvalid
};
diff --git a/src/backend/gporca/libgpopt/include/gpopt/xforms/CXformMinMax2IndexGet.h b/src/backend/gporca/libgpopt/include/gpopt/xforms/CXformMinMax2IndexGet.h
new file mode 100644
index 0000000000..cb5e429116
--- /dev/null
+++ b/src/backend/gporca/libgpopt/include/gpopt/xforms/CXformMinMax2IndexGet.h
@@ -0,0 +1,87 @@
+//-------------------------------------------------------------------
+// Greenplum Database
+// Copyright (C) 2023 VMware, Inc. or its affiliates.
+//
+// @filename:
+// CXformMinMax2IndexGet.h
+//
+// @doc:
+// Transform aggregates min, max to queries with IndexScan with
+// Limit.
+//-------------------------------------------------------------------
+#ifndef GPOPT_CXformMinMax2IndexGet_H
+#define GPOPT_CXformMinMax2IndexGet_H
+
+#include "gpos/base.h"
+
+#include "gpopt/operators/CLogical.h"
+#include "gpopt/xforms/CXformExploration.h"
+
+namespace gpopt
+{
+using namespace gpos;
+
+//-------------------------------------------------------------------
+// @class:
+// CXformMinMax2IndexGet
+//
+// @doc:
+// Transform aggregates min, max to queries with IndexScan with
+// Limit.
+//-------------------------------------------------------------------
+class CXformMinMax2IndexGet : public CXformExploration
+{
+private:
+ // helper function to validate if index is applicable and determine Index Scan
+ // direction, given index columns.
+ static EIndexScanDirection GetScanDirection(const IMDIndex *pmdindex,
+ CScalarAggFunc *popScAggFunc,
+ const IMDType *agg_col_type);
+
+ static BOOL IsMinMaxAggOnColumn(const IMDType *agg_func_type,
+ CExpression *pexprAggFunc,
+ const CColRef **agg_colref);
+
+ static IMdIdArray *GetApplicableIndices(CMemoryPool *mp,
+ const CColRef *agg_colref,
+ CColRefArray *output_col_array,
+ CMDAccessor *md_accessor,
+ const IMDRelation *pmdrel,
+ ULONG ulIndices);
+
+public:
+ CXformMinMax2IndexGet(const CXformMinMax2IndexGet &) = delete;
+
+ // ctor
+ CXformMinMax2IndexGet(CMemoryPool *mp);
+
+ // dtor
+ ~CXformMinMax2IndexGet() override = default;
+
+ // ident accessors
+ EXformId
+ Exfid() const override
+ {
+ return ExfMinMax2IndexGet;
+ }
+
+ // return a string for xform name
+ const CHAR *
+ SzId() const override
+ {
+ return "CXformMinMax2IndexGet";
+ }
+
+ // compute xform promise for a given expression handle
+ EXformPromise Exfp(CExpressionHandle &exprhdl) const override;
+
+ // actual transform
+ void Transform(CXformContext *pxfctxt, CXformResult *pxfres,
+ CExpression *pexpr) const override;
+
+}; // class CXformMinMax2IndexGet
+
+} // namespace gpopt
+
+
+#endif //GPOPT_CXformMinMax2IndexGet_H
diff --git a/src/backend/gporca/libgpopt/include/gpopt/xforms/CXformUtils.h b/src/backend/gporca/libgpopt/include/gpopt/xforms/CXformUtils.h
index db55b2184b..b7277009e2 100644
--- a/src/backend/gporca/libgpopt/include/gpopt/xforms/CXformUtils.h
+++ b/src/backend/gporca/libgpopt/include/gpopt/xforms/CXformUtils.h
@@ -177,15 +177,6 @@ private:
CColRefSet *pcrsGrpByUsed,
CColRefSet *pcrsFKey);
- // construct an expression representing a new access path using the given functors for
- // operator constructors and rewritten access path
- static CExpression *PexprBuildBtreeIndexPlan(
- CMemoryPool *mp, CMDAccessor *md_accessor, CExpression *pexprGet,
- ULONG ulOriginOpId, CExpressionArray *pdrgpexprConds,
- CColRefSet *pcrsScalarExpr, CColRefSet *outer_refs,
- const IMDIndex *pmdindex, const IMDRelation *pmdrel,
- EIndexScanDirection indexScanDirection, BOOL indexForOrderBy);
-
// create a dynamic operator for a btree index plan
static CLogical *
PopDynamicBtreeIndexOpConstructor(
@@ -432,22 +423,6 @@ public:
CXform::ExfSequenceProject2Apply == exfid;
}
- // helper for creating IndexGet/DynamicIndexGet expression
- static CExpression *
- PexprLogicalIndexGet(CMemoryPool *mp, CMDAccessor *md_accessor,
- CExpression *pexprGet, ULONG ulOriginOpId,
- CExpressionArray *pdrgpexprConds,
- CColRefSet *pcrsScalarExpr, CColRefSet *outer_refs,
- const IMDIndex *pmdindex, const IMDRelation *pmdrel,
- BOOL indexForOrderBy,
- EIndexScanDirection indexScanDirection)
- {
- return PexprBuildBtreeIndexPlan(mp, md_accessor, pexprGet, ulOriginOpId,
- pdrgpexprConds, pcrsScalarExpr,
- outer_refs, pmdindex, pmdrel,
- indexScanDirection, indexForOrderBy);
- }
-
// helper for creating bitmap bool op expressions
static CExpression *PexprScalarBitmapBoolOp(
CMemoryPool *mp, CMDAccessor *md_accessor,
@@ -571,6 +546,22 @@ public:
CTableDescriptor *ptabdesc,
CColRefArray *pdrgpcrOutput);
+ static void ComputeOrderSpecForIndexKey(CMemoryPool *mp,
+ COrderSpec **order_spec,
+ const IMDIndex *pmdindex,
+ EIndexScanDirection scan_direction,
+ const CColRef *colref,
+ ULONG key_position);
+
+ // construct an expression representing a new access path using the given functors for
+ // operator constructors and rewritten access path
+ static CExpression *PexprBuildBtreeIndexPlan(
+ CMemoryPool *mp, CMDAccessor *md_accessor, CExpression *pexprGet,
+ ULONG ulOriginOpId, CExpressionArray *pdrgpexprConds,
+ CColRefSet *pcrsScalarExpr, CColRefSet *outer_refs,
+ const IMDIndex *pmdindex, const IMDRelation *pmdrel,
+ EIndexScanDirection indexScanDirection, BOOL indexForOrderBy);
+
}; // class CXformUtils
diff --git a/src/backend/gporca/libgpopt/include/gpopt/xforms/xforms.h b/src/backend/gporca/libgpopt/include/gpopt/xforms/xforms.h
index e5c1ef8e1b..698d4e1ea7 100644
--- a/src/backend/gporca/libgpopt/include/gpopt/xforms/xforms.h
+++ b/src/backend/gporca/libgpopt/include/gpopt/xforms/xforms.h
@@ -120,6 +120,7 @@
#include "gpopt/xforms/CXformLeftSemiJoin2NLJoin.h"
#include "gpopt/xforms/CXformLimit2IndexGet.h"
#include "gpopt/xforms/CXformMaxOneRow2Assert.h"
+#include "gpopt/xforms/CXformMinMax2IndexGet.h"
#include "gpopt/xforms/CXformProject2Apply.h"
#include "gpopt/xforms/CXformProject2ComputeScalar.h"
#include "gpopt/xforms/CXformPushDownLeftOuterJoin.h"
diff --git a/src/backend/gporca/libgpopt/src/base/CUtils.cpp b/src/backend/gporca/libgpopt/src/base/CUtils.cpp
index efa6679a3a..d1d212de85 100644
--- a/src/backend/gporca/libgpopt/src/base/CUtils.cpp
+++ b/src/backend/gporca/libgpopt/src/base/CUtils.cpp
@@ -2539,6 +2539,16 @@ CUtils::FScalarConstOrBinaryCoercible(CExpression *pexpr)
return CUtils::FScalarConst(pexpr) ||
CCastUtils::FBinaryCoercibleCastedConst(pexpr);
}
+
+// checks to see if expression is a NullTest check on a column (ex: col IS NULL)
+BOOL
+CUtils::FScalarIdentNullTest(CExpression *pexpr)
+{
+ GPOS_ASSERT(nullptr != pexpr);
+ return (CUtils::FScalarNullTest(pexpr) &&
+ CUtils::FScalarIdent((*pexpr)[0]));
+}
+
// checks to see if the expression is a scalar const TRUE
BOOL
CUtils::FScalarConstTrue(CExpression *pexpr)
@@ -4468,6 +4478,25 @@ CUtils::PexprLimit(CMemoryPool *mp, CExpression *pexpr, ULONG ulOffSet,
CExpression(mp, popLimit, pexpr, pexprLimitOffset, pexprLimitCount);
}
+// generate a limit expression on top of the given relational child with given offset, limit count and OrderSpec
+CExpression *
+CUtils::BuildLimitExprWithOrderSpec(CMemoryPool *mp, CExpression *pexpr,
+ COrderSpec *pos, ULONG ulOffSet,
+ ULONG count)
+{
+ GPOS_ASSERT(pexpr);
+ GPOS_ASSERT(nullptr != pos);
+
+ CLogicalLimit *popLimit = GPOS_NEW(mp)
+ CLogicalLimit(mp, pos, true /* fGlobal */, true /* fHasCount */,
+ false /*fTopLimitUnderDML*/);
+ CExpression *pexprLimitOffset = CUtils::PexprScalarConstInt8(mp, ulOffSet);
+ CExpression *pexprLimitCount = CUtils::PexprScalarConstInt8(mp, count);
+
+ return GPOS_NEW(mp)
+ CExpression(mp, popLimit, pexpr, pexprLimitOffset, pexprLimitCount);
+}
+
// check if a given operator is a ANY subquery
BOOL
CUtils::FAnySubquery(COperator *pop)
diff --git a/src/backend/gporca/libgpopt/src/metadata/CTableDescriptor.cpp b/src/backend/gporca/libgpopt/src/metadata/CTableDescriptor.cpp
index 07c555ac34..dfca5e7bc1 100644
--- a/src/backend/gporca/libgpopt/src/metadata/CTableDescriptor.cpp
+++ b/src/backend/gporca/libgpopt/src/metadata/CTableDescriptor.cpp
@@ -293,7 +293,7 @@ CTableDescriptor::OsPrint(IOstream &os) const
// CTableDescriptor::IndexCount
//
// @doc:
-// Returns number of b-tree indices
+// Returns number of indices in the relation
//
//
//---------------------------------------------------------------------------
diff --git a/src/backend/gporca/libgpopt/src/operators/CLogical.cpp b/src/backend/gporca/libgpopt/src/operators/CLogical.cpp
index c323aa7355..196e3862d6 100644
--- a/src/backend/gporca/libgpopt/src/operators/CLogical.cpp
+++ b/src/backend/gporca/libgpopt/src/operators/CLogical.cpp
@@ -34,6 +34,7 @@
#include "gpopt/operators/CPredicateUtils.h"
#include "gpopt/operators/CScalarIdent.h"
#include "gpopt/optimizer/COptimizerConfig.h"
+#include "gpopt/xforms/CXformUtils.h"
#include "naucrates/md/IMDCheckConstraint.h"
#include "naucrates/md/IMDColumn.h"
#include "naucrates/md/IMDIndex.h"
@@ -187,46 +188,9 @@ CLogical::PosFromIndex(CMemoryPool *mp, const IMDIndex *pmdindex,
const ULONG ulPosTabDesc = ptabdesc->GetAttributePosition(attno);
CColRef *colref = (*colref_array)[ulPosTabDesc];
- IMDId *mdid = nullptr;
- COrderSpec::ENullTreatment ent = COrderSpec::EntLast;
- // if scan direction is forward, order spec computed should match
- // the index's sort and nulls order.
- if (scan_direction == EForwardScan)
- {
- // if sort direction of key is 0(ASC), choose MDID for less than
- // type and vice-versa
- mdid =
- (pmdindex->KeySortDirectionAt(ul) == SORT_ASC)
- ? colref->RetrieveType()->GetMdidForCmpType(IMDType::EcmptL)
- : colref->RetrieveType()->GetMdidForCmpType(
- IMDType::EcmptG);
-
- // if nulls direction of key is 0, choose ENTLast and
- // vice-versa
- ent = (pmdindex->KeyNullsDirectionAt(ul) == COrderSpec::EntLast)
- ? COrderSpec::EntLast
- : COrderSpec::EntFirst;
- }
- // if scan direction is backward, order spec computed should be
- // commutative to index's sort and nulls order.
- else if (scan_direction == EBackwardScan)
- {
- // if sort order of key is 0(ASC), choose MDID for greater than
- // type and vice-versa
- mdid =
- (pmdindex->KeySortDirectionAt(ul) == SORT_ASC)
- ? colref->RetrieveType()->GetMdidForCmpType(IMDType::EcmptG)
- : colref->RetrieveType()->GetMdidForCmpType(
- IMDType::EcmptL);
-
- // if nulls direction of key is 0, choose ENTFirst and
- // vice-versa
- ent = (pmdindex->KeyNullsDirectionAt(ul) == COrderSpec::EntLast)
- ? COrderSpec::EntFirst
- : COrderSpec::EntLast;
- }
- mdid->AddRef();
- pos->Append(mdid, colref, ent);
+ // Compute and update OrderSpec for Index key
+ CXformUtils::ComputeOrderSpecForIndexKey(mp, &pos, pmdindex,
+ scan_direction, colref, ul);
}
return pos;
diff --git a/src/backend/gporca/libgpopt/src/operators/CLogicalGbAgg.cpp b/src/backend/gporca/libgpopt/src/operators/CLogicalGbAgg.cpp
index 0fb6771b56..8a37f7378d 100644
--- a/src/backend/gporca/libgpopt/src/operators/CLogicalGbAgg.cpp
+++ b/src/backend/gporca/libgpopt/src/operators/CLogicalGbAgg.cpp
@@ -600,6 +600,7 @@ CLogicalGbAgg::PxfsCandidates(CMemoryPool *mp) const
(void) xform_set->ExchangeSet(CXform::ExfGbAgg2StreamAgg);
(void) xform_set->ExchangeSet(CXform::ExfGbAgg2ScalarAgg);
(void) xform_set->ExchangeSet(CXform::ExfEagerAgg);
+ (void) xform_set->ExchangeSet(CXform::ExfMinMax2IndexGet);
return xform_set;
}
diff --git a/src/backend/gporca/libgpopt/src/operators/CPredicateUtils.cpp b/src/backend/gporca/libgpopt/src/operators/CPredicateUtils.cpp
index 3704dd0875..2315fae05f 100644
--- a/src/backend/gporca/libgpopt/src/operators/CPredicateUtils.cpp
+++ b/src/backend/gporca/libgpopt/src/operators/CPredicateUtils.cpp
@@ -31,6 +31,7 @@
#include "gpopt/operators/CScalarCmp.h"
#include "gpopt/operators/CScalarFunc.h"
#include "gpopt/operators/CScalarIdent.h"
+#include "gpopt/operators/CScalarNullTest.h"
#include "naucrates/dxl/gpdb_types.h"
#include "naucrates/md/CMDArrayCoerceCastGPDB.h"
#include "naucrates/md/CMDIdGPDB.h"
@@ -2035,9 +2036,11 @@ CPredicateUtils::PexprIndexLookupKeyOnRight(
// Check if given expression is a valid index lookup predicate, and
// return modified (as needed) expression to be used for index lookup,
// a scalar expression is a valid index lookup predicate if it is in one
-// the two forms:
+// the below forms:
// [index-key CMP expr]
// [expr CMP index-key]
+// [index-key IS NULL]
+// [index-key IS NOT NULL]
// where expr is a scalar expression that is free of index keys and
// may have outer references (in the case of index nested loops)
CExpression *
@@ -2051,6 +2054,21 @@ CPredicateUtils::PexprIndexLookup(CMemoryPool *mp, CMDAccessor *md_accessor,
GPOS_ASSERT(nullptr != pexprScalar);
GPOS_ASSERT(nullptr != pdrgpcrIndex);
+ // Predicate of form 'col IS NULL' or 'col IS NOT NULL'.
+ // This check is to enable support of "IS NULL/IS NOT NULL" conditions
+ // for btree indices.
+ if (((CUtils::FScalarIdentNullTest(pexprScalar)) ||
+ (FNot(pexprScalar) &&
+ CUtils::FScalarIdentNullTest((*pexprScalar)[0]))) &&
+ pmdindex->IndexType() == gpmd::IMDIndex::EmdindBtree)
+ {
+ // Expression is not transformed to a comparison as 'col IS NULL'
+ // or 'col IS NOT NULL' are not equivalent to 'col = NULL' or
+ // 'col!=NULL' respectively.
+ pexprScalar->AddRef();
+ return pexprScalar;
+ }
+
IMDType::ECmpType cmptype = IMDType::EcmptOther;
if (CUtils::FScalarCmp(pexprScalar))
diff --git a/src/backend/gporca/libgpopt/src/xforms/CXformFactory.cpp b/src/backend/gporca/libgpopt/src/xforms/CXformFactory.cpp
index 2adc0a1cd7..f11b5c4eb7 100644
--- a/src/backend/gporca/libgpopt/src/xforms/CXformFactory.cpp
+++ b/src/backend/gporca/libgpopt/src/xforms/CXformFactory.cpp
@@ -295,6 +295,7 @@ CXformFactory::Instantiate()
Add(GPOS_NEW(m_mp) CXformPushJoinBelowRightUnionAll(m_mp));
Add(GPOS_NEW(m_mp) CXformLimit2IndexGet(m_mp));
Add(GPOS_NEW(m_mp) CXformDynamicIndexGet2DynamicIndexOnlyScan(m_mp));
+ Add(GPOS_NEW(m_mp) CXformMinMax2IndexGet(m_mp));
GPOS_ASSERT(nullptr != m_rgpxf[CXform::ExfSentinel - 1] &&
"Not all xforms have been instantiated");
diff --git a/src/backend/gporca/libgpopt/src/xforms/CXformJoin2IndexApply.cpp b/src/backend/gporca/libgpopt/src/xforms/CXformJoin2IndexApply.cpp
index 8859a510f3..a78e54e713 100644
--- a/src/backend/gporca/libgpopt/src/xforms/CXformJoin2IndexApply.cpp
+++ b/src/backend/gporca/libgpopt/src/xforms/CXformJoin2IndexApply.cpp
@@ -204,10 +204,10 @@ CXformJoin2IndexApply::CreateAlternativesForBtreeIndex(
// We consider ForwardScan here because, BackwardScan is only supported
// in the case where we have Order by clause in the query, but this xform
// doesn't have one.
- CExpression *pexprLogicalIndexGet = CXformUtils::PexprLogicalIndexGet(
+ CExpression *pexprLogicalIndexGet = CXformUtils::PexprBuildBtreeIndexPlan(
mp, md_accessor, pexprInner, joinOp->UlOpId(), pdrgpexprConjuncts,
- pcrsScalarExpr, outer_refs, pmdindex, pmdrel, false /*indexForOrderBy*/,
- EForwardScan /*indexScanDirection*/);
+ pcrsScalarExpr, outer_refs, pmdindex, pmdrel,
+ EForwardScan /*indexScanDirection*/, false /*indexForOrderBy*/);
if (nullptr != pexprLogicalIndexGet)
{
// second child has residual predicates, create an apply of outer and inner
diff --git a/src/backend/gporca/libgpopt/src/xforms/CXformLimit2IndexGet.cpp b/src/backend/gporca/libgpopt/src/xforms/CXformLimit2IndexGet.cpp
index 3f8892427f..23de9bfb06 100644
--- a/src/backend/gporca/libgpopt/src/xforms/CXformLimit2IndexGet.cpp
+++ b/src/backend/gporca/libgpopt/src/xforms/CXformLimit2IndexGet.cpp
@@ -142,10 +142,10 @@ CXformLimit2IndexGet::Transform(CXformContext *pxfctxt, CXformResult *pxfres,
if (scan_direction != EisdSentinel)
{
// build IndexGet expression
- CExpression *pexprIndexGet = CXformUtils::PexprLogicalIndexGet(
+ CExpression *pexprIndexGet = CXformUtils::PexprBuildBtreeIndexPlan(
mp, md_accessor, pexprUpdtdRltn, popLimit->UlOpId(), pdrgpexpr,
- pcrsScalarExpr, nullptr /*outer_refs*/, pmdindex, pmdrel, true,
- scan_direction);
+ pcrsScalarExpr, nullptr /*outer_refs*/, pmdindex, pmdrel,
+ scan_direction, true);
if (pexprIndexGet != nullptr)
{
diff --git a/src/backend/gporca/libgpopt/src/xforms/CXformMinMax2IndexGet.cpp b/src/backend/gporca/libgpopt/src/xforms/CXformMinMax2IndexGet.cpp
new file mode 100644
index 0000000000..02669126e0
--- /dev/null
+++ b/src/backend/gporca/libgpopt/src/xforms/CXformMinMax2IndexGet.cpp
@@ -0,0 +1,314 @@
+//-------------------------------------------------------------------
+// Greenplum Database
+// Copyright (C) 2023 VMware, Inc. or its affiliates.
+//
+// @filename:
+// CXformMinMax2IndexGet.cpp
+//
+// @doc:
+// Transform aggregates min, max to queries with IndexScan with
+// Limit
+//-------------------------------------------------------------------
+
+#include "gpopt/xforms/CXformMinMax2IndexGet.h"
+
+#include "gpopt/operators/CLogicalGbAgg.h"
+#include "gpopt/operators/CLogicalGet.h"
+#include "gpopt/operators/CScalarProjectList.h"
+#include "gpopt/xforms/CXformUtils.h"
+
+using namespace gpopt;
+
+
+//-------------------------------------------------------------------
+// @function:
+// CXformMinMax2IndexGet::CXformMinMax2IndexGet
+//
+// @doc:
+// Ctor
+//
+//-------------------------------------------------------------------
+CXformMinMax2IndexGet::CXformMinMax2IndexGet(CMemoryPool *mp)
+ : // pattern
+ CXformExploration(
+ // pattern
+ GPOS_NEW(mp) CExpression(
+ mp, GPOS_NEW(mp) CLogicalGbAgg(mp),
+ GPOS_NEW(mp) CExpression(
+ mp,
+ GPOS_NEW(mp) CLogicalGet(mp)), // relational child
+ GPOS_NEW(mp) CExpression(
+ mp,
+ GPOS_NEW(mp) CScalarProjectList(mp), // scalar project list
+ GPOS_NEW(mp) CExpression(
+ mp,
+ GPOS_NEW(mp)
+ CScalarProjectElement(mp), // scalar project element
+ GPOS_NEW(mp)
+ CExpression(mp, GPOS_NEW(mp) CPatternTree(mp))))))
+{
+}
+
+//---------------------------------------------------------------------------
+// @function:
+// CXformMinMax2IndexGet::Exfp
+//
+// @doc:
+// Compute xform promise for a given expression handle;
+// GbAgg must be global and have empty grouping columns
+//
+//---------------------------------------------------------------------------
+CXform::EXformPromise
+CXformMinMax2IndexGet::Exfp(CExpressionHandle &exprhdl) const
+{
+ CLogicalGbAgg *popAgg = CLogicalGbAgg::PopConvert(exprhdl.Pop());
+ if (!popAgg->FGlobal() || 0 < popAgg->Pdrgpcr()->Size())
+ {
+ return CXform::ExfpNone;
+ }
+
+ return CXform::ExfpHigh;
+}
+
+
+//---------------------------------------------------------------------------
+// @function:
+// CXformMinMax2IndexGet::Transform
+//
+// @doc:
+// Actual transformation
+//
+// Input Query: select max(b) from foo;
+// Output Query: select max(b) from (select * from foo where b is
+// not null order by b limit 1);
+//---------------------------------------------------------------------------
+void
+CXformMinMax2IndexGet::Transform(CXformContext *pxfctxt, CXformResult *pxfres,
+ CExpression *pexpr) const
+{
+ GPOS_ASSERT(nullptr != pxfctxt);
+ GPOS_ASSERT(FPromising(pxfctxt->Pmp(), this, pexpr));
+ GPOS_ASSERT(FCheckPattern(pexpr));
+
+ CMemoryPool *mp = pxfctxt->Pmp();
+
+ // extract components
+ CExpression *pexprRel = (*pexpr)[0];
+ CExpression *pexprScalarPrjList = (*pexpr)[1];
+
+ CLogicalGet *popGet = CLogicalGet::PopConvert(pexprRel->Pop());
+ // get the indices count of this relation
+ const ULONG ulIndices = popGet->Ptabdesc()->IndexCount();
+
+ // Ignore xform if relation doesn't have any indices
+ if (0 == ulIndices)
+ {
+ return;
+ }
+
+ CExpression *pexprPrjEl = (*pexprScalarPrjList)[0];
+ CExpression *pexprAggFunc = (*pexprPrjEl)[0];
+ CScalarAggFunc *popScAggFunc =
+ CScalarAggFunc::PopConvert(pexprAggFunc->Pop());
+ CMDAccessor *md_accessor = COptCtxt::PoctxtFromTLS()->Pmda();
+
+ IMDId *agg_func_mdid = CScalar::PopConvert(popScAggFunc)->MdidType();
+ const IMDType *agg_func_type = md_accessor->RetrieveType(agg_func_mdid);
+
+ const IMDRelation *pmdrel =
+ md_accessor->RetrieveRel(popGet->Ptabdesc()->MDId());
+
+ const CColRef *agg_colref = nullptr;
+
+ // Check if agg function is min/max and aggregate is on a column
+ if (!IsMinMaxAggOnColumn(agg_func_type, pexprAggFunc, &agg_colref))
+ {
+ return;
+ }
+
+ IMdIdArray *btree_indices =
+ GetApplicableIndices(mp, agg_colref, popGet->PdrgpcrOutput(),
+ md_accessor, pmdrel, ulIndices);
+
+ // Check if relation has btree indices with leading index key as agg column
+ if (btree_indices->Size() == 0)
+ {
+ btree_indices->Release();
+ return;
+ }
+
+ // Generate index column not null condition.
+ CExpression *notNullExpr =
+ CUtils::PexprIsNotNull(mp, CUtils::PexprScalarIdent(mp, agg_colref));
+
+ CExpressionArray *pdrgpexpr = GPOS_NEW(mp) CExpressionArray(mp);
+ notNullExpr->AddRef();
+ pdrgpexpr->Append(notNullExpr);
+
+ popGet->AddRef();
+ CExpression *pexprGetNotNull =
+ GPOS_NEW(mp) CExpression(mp, popGet, notNullExpr);
+
+ CColRefSet *pcrsScalarExpr = GPOS_NEW(mp) CColRefSet(mp);
+ pcrsScalarExpr->Include(agg_colref);
+ CLogicalGbAgg *popAgg = CLogicalGbAgg::PopConvert(pexpr->Pop());
+
+ for (ULONG ul = 0; ul < btree_indices->Size(); ul++)
+ {
+ IMDId *pmdidIndex = (*btree_indices)[ul];
+ const IMDIndex *pmdindex = md_accessor->RetrieveIndex(pmdidIndex);
+
+ // Check if index is applicable and get scan direction
+ EIndexScanDirection scan_direction =
+ GetScanDirection(pmdindex, popScAggFunc, agg_func_type);
+
+ // build IndexGet expression
+ CExpression *pexprIndexGet = CXformUtils::PexprBuildBtreeIndexPlan(
+ mp, md_accessor, pexprGetNotNull, popAgg->UlOpId(), pdrgpexpr,
+ pcrsScalarExpr, nullptr /*outer_refs*/, pmdindex, pmdrel,
+ scan_direction, false);
+
+ if (pexprIndexGet != nullptr)
+ {
+ COrderSpec *pos = nullptr;
+ // Compute and update the required OrderSpec for first index key
+ CXformUtils::ComputeOrderSpecForIndexKey(mp, &pos, pmdindex,
+ scan_direction, agg_colref,
+ 0 /*key position*/);
+
+ // build Limit expression
+ CExpression *pexprLimit = CUtils::BuildLimitExprWithOrderSpec(
+ mp, pexprIndexGet, pos, 0 /*limitOffset*/, 1 /*limitCount*/);
+
+ popAgg->AddRef();
+ pexprScalarPrjList->AddRef();
+
+ // build Aggregate expression
+ CExpression *finalpexpr = GPOS_NEW(mp)
+ CExpression(mp, popAgg, pexprLimit, pexprScalarPrjList);
+
+ pxfres->Add(finalpexpr);
+ }
+ }
+
+ btree_indices->Release();
+ pcrsScalarExpr->Release();
+ pdrgpexpr->Release();
+ pexprGetNotNull->Release();
+}
+
+//---------------------------------------------------------------------------
+// @function:
+// CXformMinMax2IndexGet::GetScanDirection
+//
+// @doc:
+// Function to validate if index is applicable and determine Index Scan
+// direction, given index columns. This function checks if aggregate column
+// is prefix of the index columns.
+//---------------------------------------------------------------------------
+EIndexScanDirection
+CXformMinMax2IndexGet::GetScanDirection(const IMDIndex *pmdindex,
+ CScalarAggFunc *popScAggFunc,
+ const IMDType *agg_col_type)
+{
+ // If Aggregate function is min()
+ if (popScAggFunc->MDId()->Equals(
+ agg_col_type->GetMdidForAggType(IMDType::EaggMin)))
+ {
+ // Find the minimum element by:
+ // 1. Scanning Forward, if index is sorted in ascending order.
+ // 2. Scanning Backward, if index is sorted in descending order.
+ return pmdindex->KeySortDirectionAt(0) == SORT_DESC ? EBackwardScan
+ : EForwardScan;
+ }
+ // If Aggregate function is max()
+ else
+ {
+ // Find the maximum element by:
+ // 1. Scanning Forward, if index is sorted in descending order.
+ // 2. Scanning Backward, if index is sorted in ascending order.
+ return pmdindex->KeySortDirectionAt(0) == SORT_DESC ? EForwardScan
+ : EBackwardScan;
+ }
+}
+
+//---------------------------------------------------------------------------
+// @function:
+// CXformMinMax2IndexGet::IsMinMaxAggOnColumn
+//
+// @doc:
+// This function checks if the aggregate is min or max and is
+// performed on a column to determine if this transform
+// applies for a given pattern.
+//---------------------------------------------------------------------------
+BOOL
+CXformMinMax2IndexGet::IsMinMaxAggOnColumn(const IMDType *agg_func_type,
+ CExpression *pexprAggFunc,
+ const CColRef **agg_colref)
+{
+ CScalarAggFunc *popScAggFunc =
+ CScalarAggFunc::PopConvert(pexprAggFunc->Pop());
+
+ // Check if aggregate function is either min() or max()
+ if (!popScAggFunc->IsMinMax(agg_func_type))
+ {
+ return false;
+ }
+
+ // Extracts aggregate column from below part in the expression tree
+ // +--CScalarAggFunc
+ // |--CScalarValuesList
+ // | +--CScalarIdent "a" (0)
+ *agg_colref = CCastUtils::PcrExtractFromScIdOrCastScId(
+ (*(*pexprAggFunc)[EAggfuncChildIndices::EaggfuncIndexArgs])[0]);
+
+ // Check if min/max aggregation performed on a column or cast
+ // of column. This optimization isn't necessary for min/max on constants.
+ if (nullptr == *agg_colref)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+//---------------------------------------------------------------------------
+// @function:
+// CXformMinMax2IndexGet::GetApplicableIndices
+//
+// @doc:
+// This function checks if the relation has any btree indices that have
+// leading index key as the aggregate column to determine if this transform
+// applies for a given pattern.
+//---------------------------------------------------------------------------
+IMdIdArray *
+CXformMinMax2IndexGet::GetApplicableIndices(
+ CMemoryPool *mp, const CColRef *agg_colref, CColRefArray *output_col_array,
+ CMDAccessor *md_accessor, const IMDRelation *pmdrel, ULONG ulIndices)
+{
+ CColRefArray *pdrgpcrIndexColumns = nullptr;
+ IMdIdArray *btree_indices = GPOS_NEW(mp) IMdIdArray(mp);
+
+ for (ULONG ul = 0; ul < ulIndices; ul++)
+ {
+ IMDId *pmdidIndex = pmdrel->IndexMDidAt(ul);
+ const IMDIndex *pmdindex = md_accessor->RetrieveIndex(pmdidIndex);
+ // get columns in the index
+ pdrgpcrIndexColumns = CXformUtils::PdrgpcrIndexKeys(
+ mp, output_col_array, pmdindex, pmdrel);
+
+ // Ordered IndexScan is only applicable if index type is Btree and
+ // if aggregate function's column matches with first index key
+ if (pmdindex->IndexType() == IMDIndex::EmdindBtree &&
+ CColRef::Equals(agg_colref, (*pdrgpcrIndexColumns)[0]))
+ {
+ pmdidIndex->AddRef();
+ btree_indices->Append(pmdidIndex);
+ }
+ pdrgpcrIndexColumns->Release();
+ }
+
+ return btree_indices;
+}
+
+// EOF
diff --git a/src/backend/gporca/libgpopt/src/xforms/CXformSelect2DynamicIndexGet.cpp b/src/backend/gporca/libgpopt/src/xforms/CXformSelect2DynamicIndexGet.cpp
index 0cfd5eaf42..c5a884349a 100644
--- a/src/backend/gporca/libgpopt/src/xforms/CXformSelect2DynamicIndexGet.cpp
+++ b/src/backend/gporca/libgpopt/src/xforms/CXformSelect2DynamicIndexGet.cpp
@@ -128,10 +128,12 @@ CXformSelect2DynamicIndexGet::Transform(CXformContext *pxfctxt,
// only supported in the case where we have Order by clause in the
// query, but this xform handles scenario of a filter on top of a
// partitioned table.
- CExpression *pexprDynamicIndexGet = CXformUtils::PexprLogicalIndexGet(
- mp, md_accessor, pexprRelational, pexpr->Pop()->UlOpId(), pdrgpexpr,
- pcrsScalarExpr, nullptr /*outer_refs*/, pmdindex, pmdrel,
- false /*indexForOrderBy*/, EForwardScan /*indexScanDirection*/);
+ CExpression *pexprDynamicIndexGet =
+ CXformUtils::PexprBuildBtreeIndexPlan(
+ mp, md_accessor, pexprRelational, pexpr->Pop()->UlOpId(),
+ pdrgpexpr, pcrsScalarExpr, nullptr /*outer_refs*/, pmdindex,
+ pmdrel, EForwardScan /*indexScanDirection*/,
+ false /*indexForOrderBy*/);
if (nullptr != pexprDynamicIndexGet)
{
// create a redundant SELECT on top of DynamicIndexGet to be able to use predicate in partition elimination
diff --git a/src/backend/gporca/libgpopt/src/xforms/CXformSelect2IndexGet.cpp b/src/backend/gporca/libgpopt/src/xforms/CXformSelect2IndexGet.cpp
index 64c3119c1d..19538ae4da 100644
--- a/src/backend/gporca/libgpopt/src/xforms/CXformSelect2IndexGet.cpp
+++ b/src/backend/gporca/libgpopt/src/xforms/CXformSelect2IndexGet.cpp
@@ -112,10 +112,10 @@ CXformSelect2IndexGet::Transform(CXformContext *pxfctxt, CXformResult *pxfres,
// We consider ForwardScan here because, BackwardScan is only supported
// in the case where we have Order by clause in the query, but this
// xform handles scenario of a filter on top of a regular table
- CExpression *pexprIndexGet = CXformUtils::PexprLogicalIndexGet(
+ CExpression *pexprIndexGet = CXformUtils::PexprBuildBtreeIndexPlan(
mp, md_accessor, pexprRelational, pexpr->Pop()->UlOpId(), pdrgpexpr,
pcrsScalarExpr, nullptr /*outer_refs*/, pmdindex, pmdrel,
- false /*indexForOrderBy*/, EForwardScan /*indexScanDirection*/);
+ EForwardScan /*indexScanDirection*/, false /*indexForOrderBy*/);
if (nullptr != pexprIndexGet)
{
pxfres->Add(pexprIndexGet);
diff --git a/src/backend/gporca/libgpopt/src/xforms/CXformUtils.cpp b/src/backend/gporca/libgpopt/src/xforms/CXformUtils.cpp
index c09f670e16..8a80ed8de0 100644
--- a/src/backend/gporca/libgpopt/src/xforms/CXformUtils.cpp
+++ b/src/backend/gporca/libgpopt/src/xforms/CXformUtils.cpp
@@ -4163,4 +4163,64 @@ CXformUtils::FCoverIndex(CMemoryPool *mp, CIndexDescriptor *pindexdesc,
return true;
}
+//---------------------------------------------------------------------------
+// CXformUtils::ComputeOrderSpecForIndexKey
+//
+// Determine the OrderSpec for an index key based on the direction of
+// the index scan and the position of the index key. This function
+// creates a new OrderSpec object and computes its value if a nullptr is
+// passed; otherwise, it appends to the existing OrderSpec object.
+//---------------------------------------------------------------------------
+void
+CXformUtils::ComputeOrderSpecForIndexKey(CMemoryPool *mp,
+ COrderSpec **order_spec,
+ const IMDIndex *pmdindex,
+ EIndexScanDirection scan_direction,
+ const CColRef *colref,
+ ULONG key_position)
+{
+ // Create a new OrderSpec object if a nullptr is passed
+ if (*order_spec == nullptr)
+ {
+ (*order_spec) = GPOS_NEW(mp) COrderSpec(mp);
+ }
+ IMDId *mdid = nullptr;
+ COrderSpec::ENullTreatment ent = COrderSpec::EntLast;
+ // if scan direction is forward, order spec computed should match
+ // the index's sort and nulls order.
+ if (scan_direction == EForwardScan)
+ {
+ // if sort direction of key is 0(ASC), choose MDID for less than
+ // type and vice-versa
+ mdid = (pmdindex->KeySortDirectionAt(key_position) == SORT_ASC)
+ ? colref->RetrieveType()->GetMdidForCmpType(IMDType::EcmptL)
+ : colref->RetrieveType()->GetMdidForCmpType(IMDType::EcmptG);
+
+ // if nulls direction of key is 0, choose ENTLast and
+ // vice-versa
+ ent =
+ (pmdindex->KeyNullsDirectionAt(key_position) == COrderSpec::EntLast)
+ ? COrderSpec::EntLast
+ : COrderSpec::EntFirst;
+ }
+ // if scan direction is backward, order spec computed should be
+ // commutative to index's sort and nulls order.
+ else if (scan_direction == EBackwardScan)
+ {
+ // if sort order of key is 0(ASC), choose MDID for greater than
+ // type and vice-versa
+ mdid = (pmdindex->KeySortDirectionAt(key_position) == SORT_ASC)
+ ? colref->RetrieveType()->GetMdidForCmpType(IMDType::EcmptG)
+ : colref->RetrieveType()->GetMdidForCmpType(IMDType::EcmptL);
+
+ // if nulls direction of key is 0, choose ENTFirst and
+ // vice-versa
+ ent =
+ (pmdindex->KeyNullsDirectionAt(key_position) == COrderSpec::EntLast)
+ ? COrderSpec::EntFirst
+ : COrderSpec::EntLast;
+ }
+ mdid->AddRef();
+ (*order_spec)->Append(mdid, colref, ent);
+}
// EOF
\ No newline at end of file
diff --git a/src/backend/gporca/libgpopt/src/xforms/Makefile b/src/backend/gporca/libgpopt/src/xforms/Makefile
index 30b96d0712..2933c59671 100644
--- a/src/backend/gporca/libgpopt/src/xforms/Makefile
+++ b/src/backend/gporca/libgpopt/src/xforms/Makefile
@@ -104,6 +104,7 @@ OBJS = CDecorrelator.o \
CXformLeftSemiJoin2NLJoin.o \
CXformLimit2IndexGet.o \
CXformMaxOneRow2Assert.o \
+ CXformMinMax2IndexGet.o \
CXformDynamicForeignGet2DynamicForeignScan.o \
CXformProject2Apply.o \
CXformProject2ComputeScalar.o \
diff --git a/src/backend/gporca/server/CMakeLists.txt b/src/backend/gporca/server/CMakeLists.txt
index 10517890b3..1f6344b059 100644
--- a/src/backend/gporca/server/CMakeLists.txt
+++ b/src/backend/gporca/server/CMakeLists.txt
@@ -109,7 +109,8 @@ IndexScan-ORPredsNonPart IndexScan-ORPredsAOPart IndexScan-AndedIn SubqInIndexPr
IndexScan-OrderBy-on-Single-IndexCol IndexScan-OrderBy-on-Multiple-IndexCols IndexScan-OrderBy-on-NonIndexCol
Forward-IndexScan-OrderBy-on-SingleCol-Index Backward-IndexScan-OrderBy-on-SingleCol-Index
Forward-IndexScan-OrderBy-on-MultiCol-Index Backward-IndexScan-OrderBy-on-MultiCol-Index
-IndexScan-OrderBy-on-MultiCol-NonIndex;
+IndexScan-OrderBy-on-MultiCol-NonIndex Max-Aggregate-uses-IndexScan-and-Limit
+Min-Aggregate-uses-IndexScan-and-Limit IndexScan-IsNullPred IndexScan-IsNotNullPred;
CBitmapScanTest:
IndexedNLJBitmap BitmapIndex-ChooseHashJoin BitmapTableScan-AO-Btree-PickOnlyHighNDV
diff --git a/src/include/gpopt/translate/CIndexQualInfo.h b/src/include/gpopt/translate/CIndexQualInfo.h
index 688e151d77..b2c45d080c 100644
--- a/src/include/gpopt/translate/CIndexQualInfo.h
+++ b/src/include/gpopt/translate/CIndexQualInfo.h
@@ -65,7 +65,8 @@ public:
{
GPOS_ASSERT((IsA(m_expr, OpExpr) && IsA(m_original_expr, OpExpr)) ||
(IsA(m_expr, ScalarArrayOpExpr) &&
- IsA(original_expr, ScalarArrayOpExpr)));
+ IsA(original_expr, ScalarArrayOpExpr)) ||
+ (IsA(m_expr, NullTest) && IsA(original_expr, NullTest)));
}
// dtor
diff --git a/src/test/regress/expected/aggregates_optimizer.out b/src/test/regress/expected/aggregates_optimizer.out
index 944c8cbf57..a956b9379c 100644
--- a/src/test/regress/expected/aggregates_optimizer.out
+++ b/src/test/regress/expected/aggregates_optimizer.out
@@ -907,14 +907,17 @@ FROM bool_test;
-- Basic cases
explain (costs off)
select min(unique1) from tenk1;
- QUERY PLAN
-------------------------------------------------
- Finalize Aggregate
- -> Gather Motion 3:1 (slice1; segments: 3)
- -> Partial Aggregate
- -> Seq Scan on tenk1
- Optimizer: Pivotal Optimizer (GPORCA)
-(5 rows)
+ QUERY PLAN
+----------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: unique1
+ -> Limit
+ -> Index Only Scan using tenk1_unique1 on tenk1
+ Index Cond: (unique1 IS NOT NULL)
+ Optimizer: GPORCA
+(8 rows)
select min(unique1) from tenk1;
min
@@ -924,14 +927,17 @@ select min(unique1) from tenk1;
explain (costs off)
select max(unique1) from tenk1;
- QUERY PLAN
-------------------------------------------------
- Finalize Aggregate
- -> Gather Motion 3:1 (slice1; segments: 3)
- -> Partial Aggregate
- -> Seq Scan on tenk1
- Optimizer: Pivotal Optimizer (GPORCA)
-(5 rows)
+ QUERY PLAN
+-------------------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: unique1
+ -> Limit
+ -> Index Only Scan Backward using tenk1_unique1 on tenk1
+ Index Cond: (unique1 IS NOT NULL)
+ Optimizer: GPORCA
+(8 rows)
select max(unique1) from tenk1;
max
@@ -1075,14 +1081,17 @@ select f1, (select min(unique1) from tenk1 where unique1 > f1) AS gt
-- check some cases that were handled incorrectly in 8.3.0
explain (costs off)
select distinct max(unique2) from tenk1;
- QUERY PLAN
-------------------------------------------------
- Finalize Aggregate
- -> Gather Motion 3:1 (slice1; segments: 3)
- -> Partial Aggregate
- -> Seq Scan on tenk1
- Optimizer: Pivotal Optimizer (GPORCA)
-(5 rows)
+ QUERY PLAN
+-------------------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: unique2
+ -> Limit
+ -> Index Only Scan Backward using tenk1_unique2 on tenk1
+ Index Cond: (unique2 IS NOT NULL)
+ Optimizer: GPORCA
+(8 rows)
select distinct max(unique2) from tenk1;
max
@@ -1096,12 +1105,15 @@ explain (costs off)
------------------------------------------------------
Sort
Sort Key: (max(unique2))
- -> Finalize Aggregate
- -> Gather Motion 3:1 (slice1; segments: 3)
- -> Partial Aggregate
- -> Seq Scan on tenk1
- Optimizer: Pivotal Optimizer (GPORCA)
-(7 rows)
+ -> Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: unique2
+ -> Limit
+ -> Index Only Scan Backward using tenk1_unique2 on tenk1
+ Index Cond: (unique2 IS NOT NULL)
+ Optimizer: GPORCA
+(10 rows)
select max(unique2) from tenk1 order by 1;
max
@@ -1115,12 +1127,15 @@ explain (costs off)
------------------------------------------------------
Sort
Sort Key: (max(unique2))
- -> Finalize Aggregate
- -> Gather Motion 3:1 (slice1; segments: 3)
- -> Partial Aggregate
- -> Seq Scan on tenk1
- Optimizer: Pivotal Optimizer (GPORCA)
-(7 rows)
+ -> Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: unique2
+ -> Limit
+ -> Index Only Scan Backward using tenk1_unique2 on tenk1
+ Index Cond: (unique2 IS NOT NULL)
+ Optimizer: GPORCA
+(10 rows)
select max(unique2) from tenk1 order by max(unique2);
max
@@ -1155,12 +1170,15 @@ explain (costs off)
Sort
Sort Key: (generate_series(1, 3)) DESC
-> ProjectSet
- -> Finalize Aggregate
- -> Gather Motion 3:1 (slice1; segments: 3)
- -> Partial Aggregate
- -> Seq Scan on tenk1
- Optimizer: Pivotal Optimizer (GPORCA)
-(8 rows)
+ -> Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: unique2
+ -> Limit
+ -> Index Only Scan Backward using tenk1_unique2 on tenk1
+ Index Cond: (unique2 IS NOT NULL)
+ Optimizer: GPORCA
+(11 rows)
select max(unique2), generate_series(1,3) as g from tenk1 order by g desc;
max | g
diff --git a/src/test/regress/expected/dpe.out b/src/test/regress/expected/dpe.out
index ce5309b2f6..5eb28ee414 100644
--- a/src/test/regress/expected/dpe.out
+++ b/src/test/regress/expected/dpe.out
@@ -341,6 +341,14 @@ select ptid from pt where ptid in (select tid from t where t1 = 'hello' || tid)
-- start_ignore
-- Known_opt_diff: MPP-21320
-- end_ignore
+-- Disable 'CXformSelect2DynamicIndexGet' to avoid picking Dynamic Index Scan and use this test
+-- to showcase dpe alternative
+select disable_xform('CXformSelect2DynamicIndexGet');
+ disable_xform
+------------------------------------------
+ CXformSelect2DynamicIndexGet is disabled
+(1 row)
+
explain (costs off, timing off, summary off, analyze) select * from pt where exists (select 1 from t where tid = ptid and t1 = 'hello' || tid);
QUERY PLAN
---------------------------------------------------------------------------------------------
@@ -388,6 +396,13 @@ select * from pt where exists (select 1 from t where tid = ptid and t1 = 'hello'
48 | hello48 | world | drop this | 0
(18 rows)
+-- enable xform
+select enable_xform('CXformSelect2DynamicIndexGet');
+ enable_xform
+-----------------------------------------
+ CXformSelect2DynamicIndexGet is enabled
+(1 row)
+
--
-- group-by on top
--
diff --git a/src/test/regress/expected/dpe_optimizer.out b/src/test/regress/expected/dpe_optimizer.out
index 88a0642659..f23fc88772 100644
--- a/src/test/regress/expected/dpe_optimizer.out
+++ b/src/test/regress/expected/dpe_optimizer.out
@@ -299,6 +299,14 @@ select ptid from pt where ptid in (select tid from t where t1 = 'hello' || tid)
-- start_ignore
-- Known_opt_diff: MPP-21320
-- end_ignore
+-- Disable 'CXformSelect2DynamicIndexGet' to avoid picking Dynamic Index Scan and use this test
+-- to showcase dpe alternative
+select disable_xform('CXformSelect2DynamicIndexGet');
+ disable_xform
+------------------------------------------
+ CXformSelect2DynamicIndexGet is disabled
+(1 row)
+
explain (costs off, timing off, summary off, analyze) select * from pt where exists (select 1 from t where tid = ptid and t1 = 'hello' || tid);
QUERY PLAN
---------------------------------------------------------------------------------------------
@@ -342,6 +350,13 @@ select * from pt where exists (select 1 from t where tid = ptid and t1 = 'hello'
0 | hello0 | world | drop this | 0
(18 rows)
+-- enable xform
+select enable_xform('CXformSelect2DynamicIndexGet');
+ enable_xform
+-----------------------------------------
+ CXformSelect2DynamicIndexGet is enabled
+(1 row)
+
--
-- group-by on top
--
diff --git a/src/test/regress/expected/groupingsets_optimizer.out b/src/test/regress/expected/groupingsets_optimizer.out
index b0027e713c..3efc72105c 100644
--- a/src/test/regress/expected/groupingsets_optimizer.out
+++ b/src/test/regress/expected/groupingsets_optimizer.out
@@ -645,14 +645,17 @@ LINE 3: lateral (select a, b, sum(v.x) from gstest_data(v.x) ...
-- min max optimization should still work with GROUP BY ()
explain (costs off)
select min(unique1) from tenk1 GROUP BY ();
- QUERY PLAN
-------------------------------------------------
- Finalize Aggregate
- -> Gather Motion 3:1 (slice1; segments: 3)
- -> Partial Aggregate
- -> Seq Scan on tenk1
- Optimizer: Pivotal Optimizer (GPORCA)
-(5 rows)
+ QUERY PLAN
+----------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: unique1
+ -> Limit
+ -> Index Only Scan using tenk1_unique1 on tenk1
+ Index Cond: (unique1 IS NOT NULL)
+ Optimizer: GPORCA
+(8 rows)
-- Views with GROUPING SET queries
CREATE VIEW gstest_view AS select a, b, grouping(a,b), sum(c), count(*), max(c)
diff --git a/src/test/regress/expected/join_gp_optimizer.out b/src/test/regress/expected/join_gp_optimizer.out
index 925196b3b5..7995211f97 100644
--- a/src/test/regress/expected/join_gp_optimizer.out
+++ b/src/test/regress/expected/join_gp_optimizer.out
@@ -1564,13 +1564,13 @@ select * from fix_param_a left join fix_param_b on
Hash Cond: (fix_param_b.i = fix_param_a.i)
-> Hash Semi Join
Hash Cond: ((fix_param_b.i = fix_param_c.i) AND (fix_param_b.j = fix_param_c.j))
- -> Seq Scan on fix_param_b
- Filter: (NOT (i IS NULL))
+ -> Index Scan using fix_param_b_i_key on fix_param_b
+ Index Cond: (i IS NOT NULL)
-> Hash
-> Seq Scan on fix_param_c
-> Hash
-> Seq Scan on fix_param_a
- Optimizer: Pivotal Optimizer (GPORCA)
+ Optimizer: GPORCA
(15 rows)
select * from fix_param_a left join fix_param_b on
diff --git a/src/test/regress/expected/partition_prune_optimizer.out b/src/test/regress/expected/partition_prune_optimizer.out
index cc433eff42..dc78b6e6cf 100644
--- a/src/test/regress/expected/partition_prune_optimizer.out
+++ b/src/test/regress/expected/partition_prune_optimizer.out
@@ -3464,14 +3464,17 @@ explain (analyze, costs off, summary off, timing off) select * from ma_test wher
Join Filter: (ma_test.a >= (min(ma_test_p2.b)))
Rows Removed by Join Filter: 3
-> Broadcast Motion 1:3 (slice2) (actual rows=1 loops=1)
- -> Finalize Aggregate (actual rows=1 loops=1)
- -> Gather Motion 3:1 (slice3; segments: 3) (actual rows=3 loops=1)
- -> Partial Aggregate (actual rows=1 loops=1)
- -> Seq Scan on ma_test_p2 (actual rows=5 loops=1)
+ -> Aggregate (actual rows=1 loops=1)
+ -> Limit (actual rows=1 loops=1)
+ -> Gather Motion 3:1 (slice3; segments: 3) (actual rows=1 loops=1)
+ Merge Key: ma_test_p2.b
+ -> Limit (actual rows=1 loops=1)
+ -> Index Scan using ma_test_p2_b_idx on ma_test_p2 (actual rows=1 loops=1)
+ Index Cond: (b IS NOT NULL)
-> Dynamic Seq Scan on ma_test (actual rows=6 loops=2)
Number of partitions to scan: 3 (out of 3)
Partitions scanned: Avg 2.0 x 3 workers of 2 scans. Max 2 parts (seg0).
- Optimizer: Pivotal Optimizer (GPORCA)
+ Optimizer: GPORCA
(17 rows)
reset enable_seqscan;
diff --git a/src/test/regress/expected/qp_indexscan.out b/src/test/regress/expected/qp_indexscan.out
index f09f6a5aca..e8af9eee9f 100644
--- a/src/test/regress/expected/qp_indexscan.out
+++ b/src/test/regress/expected/qp_indexscan.out
@@ -3247,3 +3247,797 @@ explain(costs off) select a from part_table1 union all select a from part_table2
reset enable_seqscan;
DROP TABLE part_table1;
DROP TABLE part_table2;
+-- Purpose: This section includes tests related to min(), max() aggregates optimization.
+CREATE TABLE min_max_aggregates(a int, b int, c int);
+CREATE INDEX multi_key_index_b_c on min_max_aggregates using btree(b DESC, c);
+ANALYZE min_max_aggregates;
+-- Testing min/max functions when table doesn't have any tuples to
+-- ensure they return 1 NULL row indicating no min or max value exists.
+-- This test is eligible for optimization.
+explain(costs off) select min(b) from min_max_aggregates;
+ QUERY PLAN
+------------------------------------------------
+ Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Seq Scan on min_max_aggregates
+ Optimizer: Postgres-based planner
+(4 rows)
+
+select min(b) from min_max_aggregates;
+ min
+-----
+
+(1 row)
+
+explain(costs off) select max(b) from min_max_aggregates;
+ QUERY PLAN
+------------------------------------------------
+ Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Seq Scan on min_max_aggregates
+ Optimizer: Postgres-based planner
+(4 rows)
+
+select max(b) from min_max_aggregates;
+ max
+-----
+
+(1 row)
+
+INSERT INTO min_max_aggregates select i, i, i from generate_series(1,100)i;
+INSERT INTO min_max_aggregates values(null, null, null);
+-- Creating this index to show that both 'multi_key_index_b_c' and
+-- 'single_key_b_desc' are eligible for min/max on column 'b' and
+-- ORCA picks the lower cost index
+CREATE INDEX single_key_b_desc on min_max_aggregates using btree(b DESC);
+ANALYZE min_max_aggregates;
+-- This query is eligible for optimization and it leverages Backward
+-- IndexScan as column 'b' in 'single_key_b_desc' is sorted in
+-- descending order and therefore, minimum value can be found at
+-- the bottom of the index
+explain(costs off) select min(b) from min_max_aggregates;
+ QUERY PLAN
+--------------------------------------------------------------------------------------------
+ Result
+ InitPlan 1 (returns $0) (slice1)
+ -> Limit
+ -> Gather Motion 3:1 (slice2; segments: 3)
+ Merge Key: min_max_aggregates.b
+ -> Index Only Scan Backward using single_key_b_desc on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: Postgres-based planner
+(8 rows)
+
+select min(b) from min_max_aggregates;
+ min
+-----
+ 1
+(1 row)
+
+-- This query is eligible for optimization and it leverages Forward
+-- IndexScan as column 'b' in 'single_key_b_desc' is sorted in
+-- descending order and therefore, maximum value can be found
+-- at the top of the index
+explain(costs off) select max(b) from min_max_aggregates;
+ QUERY PLAN
+-----------------------------------------------------------------------------------
+ Result
+ InitPlan 1 (returns $0) (slice1)
+ -> Limit
+ -> Gather Motion 3:1 (slice2; segments: 3)
+ Merge Key: min_max_aggregates.b
+ -> Index Only Scan using single_key_b_desc on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: Postgres-based planner
+(8 rows)
+
+select max(b) from min_max_aggregates;
+ max
+-----
+ 100
+(1 row)
+
+DROP INDEX single_key_b_desc;
+-- Test min/max optimization behavior on index with key direction ASC
+CREATE INDEX single_key_b_asc on min_max_aggregates using btree(b);
+ANALYZE min_max_aggregates;
+-- This query is eligible for optimization and it leverages Forward
+-- IndexScan as column 'b' in 'single_key_b_asc' is sorted in
+-- ascending order and therefore, minimum value can be found at the
+-- top of the index
+explain(costs off) select min(b) from min_max_aggregates;
+ QUERY PLAN
+----------------------------------------------------------------------------------
+ Result
+ InitPlan 1 (returns $0) (slice1)
+ -> Limit
+ -> Gather Motion 3:1 (slice2; segments: 3)
+ Merge Key: min_max_aggregates.b
+ -> Index Only Scan using single_key_b_asc on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: Postgres-based planner
+(8 rows)
+
+select min(b) from min_max_aggregates;
+ min
+-----
+ 1
+(1 row)
+
+-- This query is eligible for optimization and it leverages Backward
+-- IndexScan as column 'b' in 'single_key_b_asc' is sorted in
+-- ascending order and therefore, maximum value can be found
+-- at the bottom of the index
+explain(costs off) select max(b) from min_max_aggregates;
+ QUERY PLAN
+-------------------------------------------------------------------------------------------
+ Result
+ InitPlan 1 (returns $0) (slice1)
+ -> Limit
+ -> Gather Motion 3:1 (slice2; segments: 3)
+ Merge Key: min_max_aggregates.b
+ -> Index Only Scan Backward using single_key_b_asc on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: Postgres-based planner
+(8 rows)
+
+select max(b) from min_max_aggregates;
+ max
+-----
+ 100
+(1 row)
+
+DROP INDEX single_key_b_asc;
+-- This query is not eligible for optimization as min/max aggregates
+-- are applied on non-leading keys in the index.
+explain(costs off) select min(c) from min_max_aggregates;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: Postgres-based planner
+(5 rows)
+
+explain(costs off) select max(c) from min_max_aggregates;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: Postgres-based planner
+(5 rows)
+
+-- This query is not eligible for optimization as min/max aggregates
+-- are applied on non index column.
+explain(costs off) select min(a) from min_max_aggregates;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: Postgres-based planner
+(5 rows)
+
+explain(costs off) select max(a) from min_max_aggregates;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: Postgres-based planner
+(5 rows)
+
+-- Test min/max on a constant. This query is not eligible for
+-- optimization as it is not necessary for min/max on constants
+explain(costs off) select min(100) from min_max_aggregates;
+ QUERY PLAN
+----------------------------------------------------------
+ Result
+ InitPlan 1 (returns $0) (slice1)
+ -> Limit
+ -> Gather Motion 3:1 (slice2; segments: 3)
+ -> Result
+ One-Time Filter: (100 IS NOT NULL)
+ -> Seq Scan on min_max_aggregates
+ Optimizer: Postgres-based planner
+(8 rows)
+
+explain(costs off) select max(100) from min_max_aggregates;
+ QUERY PLAN
+----------------------------------------------------------
+ Result
+ InitPlan 1 (returns $0) (slice1)
+ -> Limit
+ -> Gather Motion 3:1 (slice2; segments: 3)
+ -> Result
+ One-Time Filter: (100 IS NOT NULL)
+ -> Seq Scan on min_max_aggregates
+ Optimizer: Postgres-based planner
+(8 rows)
+
+-- Test min/max optimization behavior with empty group by. This query
+-- is eligible for optimization as it doesn't specify any grouping columns
+explain(costs off) select min(b) from min_max_aggregates group by ();
+ QUERY PLAN
+----------------------------------------------------------------------------------------------
+ Result
+ InitPlan 1 (returns $0) (slice1)
+ -> Limit
+ -> Gather Motion 3:1 (slice2; segments: 3)
+ Merge Key: min_max_aggregates.b
+ -> Index Only Scan Backward using multi_key_index_b_c on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: Postgres-based planner
+(8 rows)
+
+select min(b) from min_max_aggregates group by ();
+ min
+-----
+ 1
+(1 row)
+
+explain(costs off) select max(b) from min_max_aggregates group by ();
+ QUERY PLAN
+-------------------------------------------------------------------------------------
+ Result
+ InitPlan 1 (returns $0) (slice1)
+ -> Limit
+ -> Gather Motion 3:1 (slice2; segments: 3)
+ Merge Key: min_max_aggregates.b
+ -> Index Only Scan using multi_key_index_b_c on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: Postgres-based planner
+(8 rows)
+
+select max(b) from min_max_aggregates group by ();
+ max
+-----
+ 100
+(1 row)
+
+-- Test min/max with non-empty group by. This query is not eligible for
+-- optimization as it has grouping columns. This check is made while
+-- computing xform promise by validating size of grouping columns and
+-- there by avoiding application of transform
+explain(costs off) select min(b) from min_max_aggregates group by b;
+ QUERY PLAN
+------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> HashAggregate
+ Group Key: b
+ -> Redistribute Motion 3:3 (slice2; segments: 3)
+ Hash Key: b
+ -> Seq Scan on min_max_aggregates
+ Optimizer: Postgres-based planner
+(7 rows)
+
+explain(costs off) select max(b) from min_max_aggregates group by b;
+ QUERY PLAN
+------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> HashAggregate
+ Group Key: b
+ -> Redistribute Motion 3:3 (slice2; segments: 3)
+ Hash Key: b
+ -> Seq Scan on min_max_aggregates
+ Optimizer: Postgres-based planner
+(7 rows)
+
+-- Test min/max optimization with CTE
+-- Test min/max optimization when used in CTE producer. This query is
+-- eligible for optimization as producer computes min aggregate on a
+-- btree index key
+explain (costs off) with cte_producer as (select min(b) as min_b from min_max_aggregates) select min_b from cte_producer;
+ QUERY PLAN
+----------------------------------------------------------------------------------------------
+ Result
+ InitPlan 1 (returns $0) (slice1)
+ -> Limit
+ -> Gather Motion 3:1 (slice2; segments: 3)
+ Merge Key: min_max_aggregates.b
+ -> Index Only Scan Backward using multi_key_index_b_c on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: Postgres-based planner
+(8 rows)
+
+with cte_producer as (select min(b) as min_b from min_max_aggregates) select min_b from cte_producer;
+ min_b
+-------
+ 1
+(1 row)
+
+-- Test min/max optimization when used in CTE consumer. This query is
+-- eligible for optimization as CTE consumer computes min aggregate on a
+-- btree index key projected by CTE producer
+explain (costs off) with cte_consumer as (select b as col_b from min_max_aggregates) select min(col_b) from cte_consumer;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: Postgres-based planner
+(5 rows)
+
+with cte_consumer as (select b as col_b from min_max_aggregates) select min(col_b) from cte_consumer;
+ min
+-----
+ 1
+(1 row)
+
+-- Test min/max optimization when used in CTE consumer. This query is not
+-- eligible for optimization, because the subquery projects 'col_b' as 'b/2'
+-- upon which the min is computed, but none of the indices store values
+-- of column 'b/2' so that IndexScan could be used on that index
+explain (costs off) with cte_consumer as (select b/2 as col_b from min_max_aggregates) select min(col_b) from cte_consumer;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: Postgres-based planner
+(5 rows)
+
+-- Test min/max optimization with Casts
+-- Case where result of min/max is casted to a different data type.
+-- This query is eligible for optimization as casting happens after
+-- aggregation.
+explain (costs off) select min(b)::int8 from min_max_aggregates;
+ QUERY PLAN
+----------------------------------------------------------------------------------------------
+ Result
+ InitPlan 1 (returns $0) (slice1)
+ -> Limit
+ -> Gather Motion 3:1 (slice2; segments: 3)
+ Merge Key: min_max_aggregates.b
+ -> Index Only Scan Backward using multi_key_index_b_c on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: Postgres-based planner
+(8 rows)
+
+select min(b)::int8 from min_max_aggregates;
+ min
+-----
+ 1
+(1 row)
+
+-- Case where min/max is computed on a column casted to a different data type.
+-- This query is eligible for optimization as column type int4 and casted
+-- type int8 belong to same opfamily
+explain (costs off) select min(b::int8) from min_max_aggregates;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: Postgres-based planner
+(5 rows)
+
+select min(b::int8) from min_max_aggregates;
+ min
+-----
+ 1
+(1 row)
+
+-- This query is not eligible for optimization as there is no operator
+-- that handles comparison of a int4 and varchar type
+explain (costs off) select min(b::varchar) from min_max_aggregates;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: Postgres-based planner
+(5 rows)
+
+-- Cases with more than one min/max aggregates in query
+-- These queries aren't eligible for optimization because the transform's
+-- pattern only contains a single Scalar Project Element that matches only
+-- a single aggregate function whereas, these queries have more than one
+-- aggregate function. Support for these queries is beyond the scope of
+-- the current PR
+explain(costs off) select min(b), max(b) from min_max_aggregates;
+ QUERY PLAN
+----------------------------------------------------------------------------------------------------------
+ Result
+ InitPlan 1 (returns $0) (slice1)
+ -> Limit
+ -> Gather Motion 3:1 (slice2; segments: 3)
+ Merge Key: min_max_aggregates.b
+ -> Index Only Scan Backward using multi_key_index_b_c on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ InitPlan 2 (returns $1) (slice3)
+ -> Limit
+ -> Gather Motion 3:1 (slice4; segments: 3)
+ Merge Key: min_max_aggregates_1.b
+ -> Index Only Scan using multi_key_index_b_c on min_max_aggregates min_max_aggregates_1
+ Index Cond: (b IS NOT NULL)
+ Optimizer: Postgres-based planner
+(14 rows)
+
+explain(costs off) select min(a) + max(a) from min_max_aggregates;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: Postgres-based planner
+(5 rows)
+
+-- Clean Up
+drop table min_max_aggregates;
+-- Test min/max optimization with union all, subqueries, joins and outer references
+CREATE TABLE table1 (a int, b int, c int);
+CREATE INDEX t1_c_idx on table1 using btree(c);
+CREATE TABLE table2 (a int, b int, c int);
+NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
+HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
+CREATE INDEX t2_c_idx on table2 using btree(c);
+INSERT INTO table1 select i, i, i from generate_series(1,100) i;
+INSERT INTO table2 select i, i, i from generate_series(1,100) i;
+ANALYZE table1;
+ANALYZE table2;
+-- Test min/max optimization when used in subqueries
+-- This query is eligible for optimization as subquery computes max
+-- aggregate on a btree index key
+explain (costs off) select b from table1 where c = (select max(c) from table1);
+ QUERY PLAN
+----------------------------------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ InitPlan 2 (returns $1) (slice2)
+ -> Result
+ InitPlan 1 (returns $0) (slice3)
+ -> Limit
+ -> Gather Motion 3:1 (slice4; segments: 3)
+ Merge Key: table1_1.c
+ -> Index Only Scan Backward using t1_c_idx on table1 table1_1
+ Index Cond: (c IS NOT NULL)
+ -> Seq Scan on table1
+ Filter: (c = $1)
+ Optimizer: Postgres-based planner
+(12 rows)
+
+select b from table1 where c = (select max(c) from table1);
+ b
+-----
+ 100
+(1 row)
+
+-- Test min/max optimization in a subquery along with a predicate.
+-- This query isn't eligible to use optimization because predicate's
+-- pattern has a Select over LogicalGet and it doesn't match with the
+-- transform's pattern
+explain (costs off) select b, (select min(c) from table1 where table1.a > 5) as min_c from table2;
+ QUERY PLAN
+-----------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ InitPlan 2 (returns $1) (slice2)
+ -> Result
+ InitPlan 1 (returns $0) (slice3)
+ -> Limit
+ -> Gather Motion 3:1 (slice4; segments: 3)
+ Merge Key: table1.c
+ -> Index Scan using t1_c_idx on table1
+ Index Cond: (c IS NOT NULL)
+ Filter: (a > 5)
+ -> Seq Scan on table2
+ Optimizer: Postgres-based planner
+(12 rows)
+
+explain (costs off) select b, (select min(c) from table1 where table1.b = table2.b) as min_c from table2;
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> Seq Scan on table2
+ SubPlan 1
+ -> Aggregate
+ -> Result
+ Filter: (table1.b = table2.b)
+ -> Materialize
+ -> Broadcast Motion 3:3 (slice2; segments: 3)
+ -> Seq Scan on table1
+ Optimizer: Postgres-based planner
+(10 rows)
+
+-- Test min/max optimization on result of union all present as part of
+-- subquery. This query is not eligible to use min/max optimization as
+-- it performs min/max on result of union all, and not directly on a table's
+-- column due to which there is mismatch in query and transform's pattern.
+-- The query pattern has LogicalUnionAll as first child of GbAgg whereas
+-- transforms pattern has LogicalGet.
+explain (costs off) select max(c) from (select c from table1 union all select c from table2) subquery;
+ QUERY PLAN
+-----------------------------------------------------------------------------
+ Result
+ InitPlan 1 (returns $0) (slice1)
+ -> Limit
+ -> Gather Motion 3:1 (slice2; segments: 3)
+ Merge Key: table1.c
+ -> Merge Append
+ Sort Key: table1.c DESC
+ -> Index Only Scan Backward using t1_c_idx on table1
+ Index Cond: (c IS NOT NULL)
+ -> Index Only Scan Backward using t2_c_idx on table2
+ Index Cond: (c IS NOT NULL)
+ Optimizer: Postgres-based planner
+(12 rows)
+
+-- Test min/max optimization on outer references.
+-- This query is eligible to use optimization as it only has single
+-- aggregate function on an index column
+explain (costs off) select (select b from table1 t1_alias where t1_alias.a = min(t1.c)) as min_val_for_c from table1 t1;
+ QUERY PLAN
+-----------------------------------------------------------------
+ Result
+ InitPlan 2 (returns $1) (slice2)
+ -> Limit
+ -> Gather Motion 3:1 (slice3; segments: 3)
+ Merge Key: t1.c
+ -> Index Only Scan using t1_c_idx on table1 t1
+ Index Cond: (c IS NOT NULL)
+ SubPlan 1
+ -> Result
+ Filter: (t1_alias.a = $1)
+ -> Materialize
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Seq Scan on table1 t1_alias
+ Optimizer: Postgres-based planner
+(14 rows)
+
+-- This query uses more than one aggregate function, and is not eligible
+-- to use optimization. This is because, query's pattern doesn't
+-- match the transforms pattern of a single Scalar Project Element.
+explain (costs off) select min(t1.c) as min_c,
+ (select b from table1 t1_alias where t1_alias.c = max(t1.c)) as b_val
+ from table1 t1;
+ QUERY PLAN
+----------------------------------------------------------------------------
+ Result
+ InitPlan 2 (returns $1) (slice2)
+ -> Limit
+ -> Gather Motion 3:1 (slice3; segments: 3)
+ Merge Key: t1.c
+ -> Index Only Scan using t1_c_idx on table1 t1
+ Index Cond: (c IS NOT NULL)
+ InitPlan 3 (returns $2) (slice4)
+ -> Limit
+ -> Gather Motion 3:1 (slice5; segments: 3)
+ Merge Key: t1_1.c
+ -> Index Only Scan Backward using t1_c_idx on table1 t1_1
+ Index Cond: (c IS NOT NULL)
+ SubPlan 1
+ -> Result
+ Filter: (t1_alias.c = $2)
+ -> Materialize
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Seq Scan on table1 t1_alias
+ Optimizer: Postgres-based planner
+(20 rows)
+
+-- Test min/max optimization used as part of projected columns in join.
+-- This query is not eligible to use the optimization as it involves
+-- join result which is not guaranteed to be sorted, unless it is an NL join.
+explain (costs off) select min(table1.c) from table1 join table2 on table1.a=table2.a;
+ QUERY PLAN
+------------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Hash Join
+ Hash Cond: (table1.a = table2.a)
+ -> Seq Scan on table1
+ -> Hash
+ -> Seq Scan on table2
+ Optimizer: Postgres-based planner
+(9 rows)
+
+-- Clean up
+drop table table1;
+drop table table2;
+-- Purpose: This section tests IS NULL/IS NOT NULL predicate on btree and non-index columns
+CREATE TABLE test_nulltype_predicates(a int, b int);
+CREATE INDEX index_b on test_nulltype_predicates using btree(b DESC);
+INSERT INTO test_nulltype_predicates select i, i from generate_series(1,3)i;
+INSERT INTO test_nulltype_predicates values(null, null);
+ANALYZE test_nulltype_predicates;
+-- Tests with IS NULL on btree index columns
+explain(costs off) select * from test_nulltype_predicates where b is null;
+ QUERY PLAN
+--------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> Seq Scan on test_nulltype_predicates
+ Filter: (b IS NULL)
+ Optimizer: Postgres-based planner
+(4 rows)
+
+select * from test_nulltype_predicates where b is null;
+ a | b
+---+---
+ |
+(1 row)
+
+-- Tests with IS NULL on non-index columns
+explain(costs off) select * from test_nulltype_predicates where a is null;
+ QUERY PLAN
+--------------------------------------------
+ Gather Motion 1:1 (slice1; segments: 1)
+ -> Seq Scan on test_nulltype_predicates
+ Filter: (a IS NULL)
+ Optimizer: Postgres-based planner
+(4 rows)
+
+-- Tests with IS NOT NULL on btree index columns
+explain(costs off) select * from test_nulltype_predicates where b is not null;
+ QUERY PLAN
+--------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> Seq Scan on test_nulltype_predicates
+ Filter: (b IS NOT NULL)
+ Optimizer: Postgres-based planner
+(4 rows)
+
+select * from test_nulltype_predicates where b is not null;
+ a | b
+---+---
+ 2 | 2
+ 3 | 3
+ 1 | 1
+(3 rows)
+
+-- Tests with IS NOT NULL on non-index columns
+explain(costs off) select * from test_nulltype_predicates where a is not null;
+ QUERY PLAN
+--------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> Seq Scan on test_nulltype_predicates
+ Filter: (a IS NOT NULL)
+ Optimizer: Postgres-based planner
+(4 rows)
+
+-- Clean Up
+drop table test_nulltype_predicates;
+-- Purpose: Test min/max optimization on AO table.
+-- IndexOnlyScans are supported but IndexScans aren't supported on AO tables
+CREATE TABLE test_ao_table(a int, b int) WITH (appendonly=true) DISTRIBUTED BY (a);
+CREATE INDEX ao_index_b on test_ao_table using btree(b desc);
+INSERT INTO test_ao_table SELECT i, i from generate_series(1,100) i;
+ANALYZE test_ao_table;
+-- Test max() aggregate. This query is eligible to use optimization
+explain(costs off) select max(b) from test_ao_table;
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Result
+ InitPlan 1 (returns $0) (slice1)
+ -> Limit
+ -> Gather Motion 3:1 (slice2; segments: 3)
+ Merge Key: test_ao_table.b
+ -> Index Only Scan using ao_index_b on test_ao_table
+ Index Cond: (b IS NOT NULL)
+ Optimizer: Postgres-based planner
+(8 rows)
+
+select max(b) from test_ao_table;
+ max
+-----
+ 100
+(1 row)
+
+-- Test min() aggregate. This query is eligible to use optimization
+explain(costs off) select min(b) from test_ao_table;
+ QUERY PLAN
+--------------------------------------------------------------------------------
+ Result
+ InitPlan 1 (returns $0) (slice1)
+ -> Limit
+ -> Gather Motion 3:1 (slice2; segments: 3)
+ Merge Key: test_ao_table.b
+ -> Index Only Scan Backward using ao_index_b on test_ao_table
+ Index Cond: (b IS NOT NULL)
+ Optimizer: Postgres-based planner
+(8 rows)
+
+select min(b) from test_ao_table;
+ min
+-----
+ 1
+(1 row)
+
+-- Clean Up
+drop table test_ao_table;
+-- Purpose: Test min/max optimization on partition tables.
+CREATE TABLE test_partition_table(a int, b int) DISTRIBUTED BY (a) PARTITION BY range(b);
+CREATE TABLE partition1 PARTITION OF test_partition_table FOR VALUES FROM (1) TO (3);
+NOTICE: table has parent, setting distribution columns to match parent table
+CREATE TABLE partition2 PARTITION OF test_partition_table FOR VALUES FROM (3) TO (6);
+NOTICE: table has parent, setting distribution columns to match parent table
+CREATE TABLE default_partition PARTITION OF test_partition_table DEFAULT;
+NOTICE: table has parent, setting distribution columns to match parent table
+CREATE INDEX part_index_b on test_partition_table using btree(b desc);
+INSERT INTO test_partition_table SELECT i, i from generate_series(1,4) i;
+-- Insert into default partition to show partition pruning
+-- for IS NULL conditions
+INSERT INTO test_partition_table values (0, NULL);
+ANALYZE test_partition_table;
+-- Test min/max aggregate on partition tables. This query is not
+-- eligible for optimization because the query's pattern has LogicalDynamicGet
+-- as first child of LogicalGbAgg whereas transform's pattern has LogicalGet.
+-- Support for these queries is beyond the scope of the current PR.
+explain(costs off) select max(b) from test_partition_table;
+ QUERY PLAN
+-------------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Append
+ -> Seq Scan on partition1
+ -> Seq Scan on partition2
+ -> Seq Scan on default_partition
+ Optimizer: Postgres-based planner
+(8 rows)
+
+explain(costs off) select min(b) from test_partition_table;
+ QUERY PLAN
+-------------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Append
+ -> Seq Scan on partition1
+ -> Seq Scan on partition2
+ -> Seq Scan on default_partition
+ Optimizer: Postgres-based planner
+(8 rows)
+
+-- Test IS NULL, IS NOT NULL on partition table btree index column.
+-- For IS NULL predicate on partition column, pruning happens
+-- whereas, for IS NOT NULL it doesn't because the Non null values
+-- could be in all of the partitions
+explain(costs off) select * from test_partition_table where b is null;
+ QUERY PLAN
+------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> Seq Scan on default_partition
+ Filter: (b IS NULL)
+ Optimizer: Postgres-based planner
+(4 rows)
+
+select * from test_partition_table where b is null;
+ a | b
+---+---
+ 0 |
+(1 row)
+
+explain(costs off) select * from test_partition_table where b is not null;
+ QUERY PLAN
+-------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> Append
+ -> Seq Scan on partition1
+ Filter: (b IS NOT NULL)
+ -> Seq Scan on partition2
+ Filter: (b IS NOT NULL)
+ -> Seq Scan on default_partition
+ Filter: (b IS NOT NULL)
+ Optimizer: Postgres-based planner
+(9 rows)
+
+select * from test_partition_table where b is not null;
+ a | b
+---+---
+ 2 | 2
+ 3 | 3
+ 4 | 4
+ 1 | 1
+(4 rows)
+
+-- Clean Up
+drop table test_partition_table;
diff --git a/src/test/regress/expected/qp_indexscan_optimizer.out b/src/test/regress/expected/qp_indexscan_optimizer.out
index 1d9f59245f..7615b7a948 100644
--- a/src/test/regress/expected/qp_indexscan_optimizer.out
+++ b/src/test/regress/expected/qp_indexscan_optimizer.out
@@ -2514,14 +2514,17 @@ explain(costs off) select c,d from test_yet_unsupported_backwrd_idxscan_cases or
-- Since col a is asc in index, max(a) could use a backward index scan
explain(costs off) select max(a) from test_yet_unsupported_backwrd_idxscan_cases;
- QUERY PLAN
---------------------------------------------------------------------------
- Finalize Aggregate
- -> Gather Motion 3:1 (slice1; segments: 3)
- -> Partial Aggregate
- -> Seq Scan on test_yet_unsupported_backwrd_idxscan_cases
- Optimizer: Pivotal Optimizer (GPORCA)
-(5 rows)
+ QUERY PLAN
+---------------------------------------------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: a
+ -> Limit
+ -> Index Scan Backward using index_a on test_yet_unsupported_backwrd_idxscan_cases
+ Index Cond: (a IS NOT NULL)
+ Optimizer: GPORCA
+(8 rows)
-- Cases with a predicate and order by (with/without limit). Order by columns commutating index column
explain(costs off) select * from test_yet_unsupported_backwrd_idxscan_cases where a>997 order by c desc, d desc;
@@ -3134,3 +3137,780 @@ explain(costs off) select a from part_table1 union all select a from part_table2
reset enable_seqscan;
DROP TABLE part_table1;
DROP TABLE part_table2;
+-- Purpose: This section includes tests related to min(), max() aggregates optimization.
+CREATE TABLE min_max_aggregates(a int, b int, c int);
+CREATE INDEX multi_key_index_b_c on min_max_aggregates using btree(b DESC, c);
+ANALYZE min_max_aggregates;
+-- Testing min/max functions when table doesn't have any tuples to
+-- ensure they return 1 NULL row indicating no min or max value exists.
+-- This test is eligible for optimization.
+explain(costs off) select min(b) from min_max_aggregates;
+ QUERY PLAN
+---------------------------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: b
+ -> Index Scan Backward using multi_key_index_b_c on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: GPORCA
+(7 rows)
+
+select min(b) from min_max_aggregates;
+ min
+-----
+
+(1 row)
+
+explain(costs off) select max(b) from min_max_aggregates;
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: b
+ -> Index Scan using multi_key_index_b_c on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: GPORCA
+(7 rows)
+
+select max(b) from min_max_aggregates;
+ max
+-----
+
+(1 row)
+
+INSERT INTO min_max_aggregates select i, i, i from generate_series(1,100)i;
+INSERT INTO min_max_aggregates values(null, null, null);
+-- Creating this index to show that both 'multi_key_index_b_c' and
+-- 'single_key_b_desc' are eligible for min/max on column 'b' and
+-- ORCA picks the lower cost index
+CREATE INDEX single_key_b_desc on min_max_aggregates using btree(b DESC);
+ANALYZE min_max_aggregates;
+-- This query is eligible for optimization and it leverages Backward
+-- IndexScan as column 'b' in 'single_key_b_desc' is sorted in
+-- descending order and therefore, minimum value can be found at
+-- the bottom of the index
+explain(costs off) select min(b) from min_max_aggregates;
+ QUERY PLAN
+-------------------------------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: b
+ -> Limit
+ -> Index Scan Backward using single_key_b_desc on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: GPORCA
+(8 rows)
+
+select min(b) from min_max_aggregates;
+ min
+-----
+ 1
+(1 row)
+
+-- This query is eligible for optimization and it leverages Forward
+-- IndexScan as column 'b' in 'single_key_b_desc' is sorted in
+-- descending order and therefore, maximum value can be found
+-- at the top of the index
+explain(costs off) select max(b) from min_max_aggregates;
+ QUERY PLAN
+----------------------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: b
+ -> Limit
+ -> Index Scan using single_key_b_desc on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: GPORCA
+(8 rows)
+
+select max(b) from min_max_aggregates;
+ max
+-----
+ 100
+(1 row)
+
+DROP INDEX single_key_b_desc;
+-- Test min/max optimization behavior on index with key direction ASC
+CREATE INDEX single_key_b_asc on min_max_aggregates using btree(b);
+ANALYZE min_max_aggregates;
+-- This query is eligible for optimization and it leverages Forward
+-- IndexScan as column 'b' in 'single_key_b_asc' is sorted in
+-- ascending order and therefore, minimum value can be found at the
+-- top of the index
+explain(costs off) select min(b) from min_max_aggregates;
+ QUERY PLAN
+---------------------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: b
+ -> Limit
+ -> Index Scan using single_key_b_asc on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: GPORCA
+(8 rows)
+
+select min(b) from min_max_aggregates;
+ min
+-----
+ 1
+(1 row)
+
+-- This query is eligible for optimization and it leverages Backward
+-- IndexScan as column 'b' in 'single_key_b_asc' is sorted in
+-- ascending order and therefore, maximum value can be found
+-- at the bottom of the index
+explain(costs off) select max(b) from min_max_aggregates;
+ QUERY PLAN
+------------------------------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: b
+ -> Limit
+ -> Index Scan Backward using single_key_b_asc on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: GPORCA
+(8 rows)
+
+select max(b) from min_max_aggregates;
+ max
+-----
+ 100
+(1 row)
+
+DROP INDEX single_key_b_asc;
+-- This query is not eligible for optimization as min/max aggregates
+-- are applied on non-leading keys in the index.
+explain(costs off) select min(c) from min_max_aggregates;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: GPORCA
+(5 rows)
+
+explain(costs off) select max(c) from min_max_aggregates;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: GPORCA
+(5 rows)
+
+-- This query is not eligible for optimization as min/max aggregates
+-- are applied on non index column.
+explain(costs off) select min(a) from min_max_aggregates;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: GPORCA
+(5 rows)
+
+explain(costs off) select max(a) from min_max_aggregates;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: GPORCA
+(5 rows)
+
+-- Test min/max on a constant. This query is not eligible for
+-- optimization as it is not necessary for min/max on constants
+explain(costs off) select min(100) from min_max_aggregates;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: GPORCA
+(5 rows)
+
+explain(costs off) select max(100) from min_max_aggregates;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: GPORCA
+(5 rows)
+
+-- Test min/max optimization behavior with empty group by. This query
+-- is eligible for optimization as it doesn't specify any grouping columns
+explain(costs off) select min(b) from min_max_aggregates group by ();
+ QUERY PLAN
+---------------------------------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: b
+ -> Limit
+ -> Index Scan Backward using multi_key_index_b_c on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: GPORCA
+(8 rows)
+
+select min(b) from min_max_aggregates group by ();
+ min
+-----
+ 1
+(1 row)
+
+explain(costs off) select max(b) from min_max_aggregates group by ();
+ QUERY PLAN
+------------------------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: b
+ -> Limit
+ -> Index Scan using multi_key_index_b_c on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: GPORCA
+(8 rows)
+
+select max(b) from min_max_aggregates group by ();
+ max
+-----
+ 100
+(1 row)
+
+-- Test min/max with non-empty group by. This query is not eligible for
+-- optimization as it has grouping columns. This check is made while
+-- computing xform promise by validating size of grouping columns and
+-- there by avoiding application of transform
+explain(costs off) select min(b) from min_max_aggregates group by b;
+ QUERY PLAN
+------------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> GroupAggregate
+ Group Key: b
+ -> Sort
+ Sort Key: b
+ -> Redistribute Motion 3:3 (slice2; segments: 3)
+ Hash Key: b
+ -> Seq Scan on min_max_aggregates
+ Optimizer: GPORCA
+(9 rows)
+
+explain(costs off) select max(b) from min_max_aggregates group by b;
+ QUERY PLAN
+------------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> GroupAggregate
+ Group Key: b
+ -> Sort
+ Sort Key: b
+ -> Redistribute Motion 3:3 (slice2; segments: 3)
+ Hash Key: b
+ -> Seq Scan on min_max_aggregates
+ Optimizer: GPORCA
+(9 rows)
+
+-- Test min/max optimization with CTE
+-- Test min/max optimization when used in CTE producer. This query is
+-- eligible for optimization as producer computes min aggregate on a
+-- btree index key
+explain (costs off) with cte_producer as (select min(b) as min_b from min_max_aggregates) select min_b from cte_producer;
+ QUERY PLAN
+---------------------------------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: b
+ -> Limit
+ -> Index Scan Backward using multi_key_index_b_c on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: GPORCA
+(8 rows)
+
+with cte_producer as (select min(b) as min_b from min_max_aggregates) select min_b from cte_producer;
+ min_b
+-------
+ 1
+(1 row)
+
+-- Test min/max optimization when used in CTE consumer. This query is
+-- eligible for optimization as CTE consumer computes min aggregate on a
+-- btree index key projected by CTE producer
+explain (costs off) with cte_consumer as (select b as col_b from min_max_aggregates) select min(col_b) from cte_consumer;
+ QUERY PLAN
+---------------------------------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: b
+ -> Limit
+ -> Index Scan Backward using multi_key_index_b_c on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: GPORCA
+(8 rows)
+
+with cte_consumer as (select b as col_b from min_max_aggregates) select min(col_b) from cte_consumer;
+ min
+-----
+ 1
+(1 row)
+
+-- Test min/max optimization when used in CTE consumer. This query is not
+-- eligible for optimization, because the subquery projects 'col_b' as 'b/2'
+-- upon which the min is computed, but none of the indices store values
+-- of column 'b/2' so that IndexScan could be used on that index
+explain (costs off) with cte_consumer as (select b/2 as col_b from min_max_aggregates) select min(col_b) from cte_consumer;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: GPORCA
+(5 rows)
+
+-- Test min/max optimization with Casts
+-- Case where result of min/max is casted to a different data type.
+-- This query is eligible for optimization as casting happens after
+-- aggregation.
+explain (costs off) select min(b)::int8 from min_max_aggregates;
+ QUERY PLAN
+---------------------------------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: b
+ -> Limit
+ -> Index Scan Backward using multi_key_index_b_c on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: GPORCA
+(8 rows)
+
+select min(b)::int8 from min_max_aggregates;
+ min
+-----
+ 1
+(1 row)
+
+-- Case where min/max is computed on a column casted to a different data type.
+-- This query is eligible for optimization as column type int4 and casted
+-- type int8 belong to same opfamily
+explain (costs off) select min(b::int8) from min_max_aggregates;
+ QUERY PLAN
+---------------------------------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: b
+ -> Limit
+ -> Index Scan Backward using multi_key_index_b_c on min_max_aggregates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: GPORCA
+(8 rows)
+
+select min(b::int8) from min_max_aggregates;
+ min
+-----
+ 1
+(1 row)
+
+-- This query is not eligible for optimization as there is no operator
+-- that handles comparison of a int4 and varchar type
+explain (costs off) select min(b::varchar) from min_max_aggregates;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: GPORCA
+(5 rows)
+
+-- Cases with more than one min/max aggregates in query
+-- These queries aren't eligible for optimization because the transform's
+-- pattern only contains a single Scalar Project Element that matches only
+-- a single aggregate function whereas, these queries have more than one
+-- aggregate function. Support for these queries is beyond the scope of
+-- the current PR
+explain(costs off) select min(b), max(b) from min_max_aggregates;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: GPORCA
+(5 rows)
+
+explain(costs off) select min(a) + max(a) from min_max_aggregates;
+ QUERY PLAN
+--------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on min_max_aggregates
+ Optimizer: GPORCA
+(5 rows)
+
+-- Clean Up
+drop table min_max_aggregates;
+-- Test min/max optimization with union all, subqueries, joins and outer references
+CREATE TABLE table1 (a int, b int, c int);
+CREATE INDEX t1_c_idx on table1 using btree(c);
+CREATE TABLE table2 (a int, b int, c int);
+CREATE INDEX t2_c_idx on table2 using btree(c);
+INSERT INTO table1 select i, i, i from generate_series(1,100) i;
+INSERT INTO table2 select i, i, i from generate_series(1,100) i;
+ANALYZE table1;
+ANALYZE table2;
+-- Test min/max optimization when used in subqueries
+-- This query is eligible for optimization as subquery computes max
+-- aggregate on a btree index key
+explain (costs off) select b from table1 where c = (select max(c) from table1);
+ QUERY PLAN
+----------------------------------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> Nested Loop
+ Join Filter: true
+ -> Broadcast Motion 1:3 (slice2)
+ -> Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice3; segments: 3)
+ Merge Key: table1.c
+ -> Limit
+ -> Index Scan Backward using t1_c_idx on table1
+ Index Cond: (c IS NOT NULL)
+ -> Index Scan using t1_c_idx on table1 table1_1
+ Index Cond: (c = (max(table1.c)))
+ Optimizer: GPORCA
+(14 rows)
+
+select b from table1 where c = (select max(c) from table1);
+ b
+-----
+ 100
+(1 row)
+
+-- Test min/max optimization in a subquery along with a predicate.
+-- This query isn't eligible to use optimization because predicate's
+-- pattern has a Select over LogicalGet and it doesn't match with the
+-- transform's pattern
+explain (costs off) select b, (select min(c) from table1 where table1.a > 5) as min_c from table2;
+ QUERY PLAN
+------------------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> Nested Loop Left Join
+ Join Filter: true
+ -> Seq Scan on table2
+ -> Materialize
+ -> Broadcast Motion 1:3 (slice2)
+ -> Finalize Aggregate
+ -> Gather Motion 3:1 (slice3; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on table1
+ Filter: (a > 5)
+ Optimizer: GPORCA
+(12 rows)
+
+explain (costs off) select b, (select min(c) from table1 where table1.b = table2.b) as min_c from table2;
+ QUERY PLAN
+------------------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> Hash Left Join
+ Hash Cond: (table2.b = table1.b)
+ -> Redistribute Motion 3:3 (slice2; segments: 3)
+ Hash Key: table2.b
+ -> Seq Scan on table2
+ -> Hash
+ -> HashAggregate
+ Group Key: table1.b
+ -> Redistribute Motion 3:3 (slice3; segments: 3)
+ Hash Key: table1.b
+ -> Seq Scan on table1
+ Optimizer: GPORCA
+(13 rows)
+
+-- Test min/max optimization on result of union all present as part of
+-- subquery. This query is not eligible to use min/max optimization as
+-- it performs min/max on result of union all, and not directly on a table's
+-- column due to which there is mismatch in query and transform's pattern.
+-- The query pattern has LogicalUnionAll as first child of GbAgg whereas
+-- transforms pattern has LogicalGet.
+explain (costs off) select max(c) from (select c from table1 union all select c from table2) subquery;
+ QUERY PLAN
+------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Append
+ -> Seq Scan on table1
+ -> Seq Scan on table2
+ Optimizer: GPORCA
+(7 rows)
+
+-- Test min/max optimization on outer references.
+-- This query is eligible to use optimization as it only has single
+-- aggregate function on an index column
+explain (costs off) select (select b from table1 t1_alias where t1_alias.a = min(t1.c)) as min_val_for_c from table1 t1;
+ QUERY PLAN
+--------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: table1.c
+ -> Limit
+ -> Index Scan using t1_c_idx on table1
+ Index Cond: (c IS NOT NULL)
+ SubPlan 1
+ -> Result
+ Filter: (table1_1.a = min(table1.c))
+ -> Materialize
+ -> Gather Motion 3:1 (slice2; segments: 3)
+ -> Seq Scan on table1 table1_1
+ Optimizer: GPORCA
+(14 rows)
+
+-- This query uses more than one aggregate function, and is not eligible
+-- to use optimization. This is because, query's pattern doesn't
+-- match the transforms pattern of a single Scalar Project Element.
+explain (costs off) select min(t1.c) as min_c,
+ (select b from table1 t1_alias where t1_alias.c = max(t1.c)) as b_val
+ from table1 t1;
+ QUERY PLAN
+--------------------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Seq Scan on table1
+ SubPlan 1
+ -> Result
+ Filter: (table1_1.c = max(table1.c))
+ -> Materialize
+ -> Gather Motion 3:1 (slice2; segments: 3)
+ -> Seq Scan on table1 table1_1
+ Optimizer: GPORCA
+(11 rows)
+
+-- Test min/max optimization used as part of projected columns in join.
+-- This query is not eligible to use the optimization as it involves
+-- join result which is not guaranteed to be sorted, unless it is an NL join.
+explain (costs off) select min(table1.c) from table1 join table2 on table1.a=table2.a;
+ QUERY PLAN
+------------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Hash Join
+ Hash Cond: (table1.a = table2.a)
+ -> Seq Scan on table1
+ -> Hash
+ -> Seq Scan on table2
+ Optimizer: GPORCA
+(9 rows)
+
+-- Clean up
+drop table table1;
+drop table table2;
+-- Purpose: This section tests IS NULL/IS NOT NULL predicate on btree and non-index columns
+CREATE TABLE test_nulltype_predicates(a int, b int);
+CREATE INDEX index_b on test_nulltype_predicates using btree(b DESC);
+INSERT INTO test_nulltype_predicates select i, i from generate_series(1,3)i;
+INSERT INTO test_nulltype_predicates values(null, null);
+ANALYZE test_nulltype_predicates;
+-- Tests with IS NULL on btree index columns
+explain(costs off) select * from test_nulltype_predicates where b is null;
+ QUERY PLAN
+------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> Index Scan using index_b on test_nulltype_predicates
+ Index Cond: (b IS NULL)
+ Optimizer: GPORCA
+(4 rows)
+
+select * from test_nulltype_predicates where b is null;
+ a | b
+---+---
+ |
+(1 row)
+
+-- Tests with IS NULL on non-index columns
+explain(costs off) select * from test_nulltype_predicates where a is null;
+ QUERY PLAN
+--------------------------------------------
+ Gather Motion 1:1 (slice1; segments: 1)
+ -> Seq Scan on test_nulltype_predicates
+ Filter: (a IS NULL)
+ Optimizer: GPORCA
+(4 rows)
+
+-- Tests with IS NOT NULL on btree index columns
+explain(costs off) select * from test_nulltype_predicates where b is not null;
+ QUERY PLAN
+------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> Index Scan using index_b on test_nulltype_predicates
+ Index Cond: (b IS NOT NULL)
+ Optimizer: GPORCA
+(4 rows)
+
+select * from test_nulltype_predicates where b is not null;
+ a | b
+---+---
+ 1 | 1
+ 3 | 3
+ 2 | 2
+(3 rows)
+
+-- Tests with IS NOT NULL on non-index columns
+explain(costs off) select * from test_nulltype_predicates where a is not null;
+ QUERY PLAN
+--------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> Seq Scan on test_nulltype_predicates
+ Filter: (NOT (a IS NULL))
+ Optimizer: GPORCA
+(4 rows)
+
+-- Clean Up
+drop table test_nulltype_predicates;
+-- Purpose: Test min/max optimization on AO table.
+-- IndexOnlyScans are supported but IndexScans aren't supported on AO tables
+CREATE TABLE test_ao_table(a int, b int) WITH (appendonly=true) DISTRIBUTED BY (a);
+CREATE INDEX ao_index_b on test_ao_table using btree(b desc);
+INSERT INTO test_ao_table SELECT i, i from generate_series(1,100) i;
+ANALYZE test_ao_table;
+-- Test max() aggregate. This query is eligible to use optimization
+explain(costs off) select max(b) from test_ao_table;
+ QUERY PLAN
+---------------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: b
+ -> Limit
+ -> Index Only Scan using ao_index_b on test_ao_table
+ Index Cond: (b IS NOT NULL)
+ Optimizer: GPORCA
+(8 rows)
+
+select max(b) from test_ao_table;
+ max
+-----
+ 100
+(1 row)
+
+-- Test min() aggregate. This query is eligible to use optimization
+explain(costs off) select min(b) from test_ao_table;
+ QUERY PLAN
+------------------------------------------------------------------------------------
+ Aggregate
+ -> Limit
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: b
+ -> Limit
+ -> Index Only Scan Backward using ao_index_b on test_ao_table
+ Index Cond: (b IS NOT NULL)
+ Optimizer: GPORCA
+(8 rows)
+
+select min(b) from test_ao_table;
+ min
+-----
+ 1
+(1 row)
+
+-- Clean Up
+drop table test_ao_table;
+-- Purpose: Test min/max optimization on partition tables.
+CREATE TABLE test_partition_table(a int, b int) DISTRIBUTED BY (a) PARTITION BY range(b);
+CREATE TABLE partition1 PARTITION OF test_partition_table FOR VALUES FROM (1) TO (3);
+NOTICE: table has parent, setting distribution columns to match parent table
+CREATE TABLE partition2 PARTITION OF test_partition_table FOR VALUES FROM (3) TO (6);
+NOTICE: table has parent, setting distribution columns to match parent table
+CREATE TABLE default_partition PARTITION OF test_partition_table DEFAULT;
+NOTICE: table has parent, setting distribution columns to match parent table
+CREATE INDEX part_index_b on test_partition_table using btree(b desc);
+INSERT INTO test_partition_table SELECT i, i from generate_series(1,4) i;
+-- Insert into default partition to show partition pruning
+-- for IS NULL conditions
+INSERT INTO test_partition_table values (0, NULL);
+ANALYZE test_partition_table;
+-- Test min/max aggregate on partition tables. This query is not
+-- eligible for optimization because the query's pattern has LogicalDynamicGet
+-- as first child of LogicalGbAgg whereas transform's pattern has LogicalGet.
+-- Support for these queries is beyond the scope of the current PR.
+explain(costs off) select max(b) from test_partition_table;
+ QUERY PLAN
+----------------------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Dynamic Seq Scan on test_partition_table
+ Number of partitions to scan: 3 (out of 3)
+ Optimizer: GPORCA
+(6 rows)
+
+explain(costs off) select min(b) from test_partition_table;
+ QUERY PLAN
+----------------------------------------------------------------
+ Finalize Aggregate
+ -> Gather Motion 3:1 (slice1; segments: 3)
+ -> Partial Aggregate
+ -> Dynamic Seq Scan on test_partition_table
+ Number of partitions to scan: 3 (out of 3)
+ Optimizer: GPORCA
+(6 rows)
+
+-- Test IS NULL, IS NOT NULL on partition table btree index column.
+-- For IS NULL predicate on partition column, pruning happens
+-- whereas, for IS NOT NULL it doesn't because the Non null values
+-- could be in all of the partitions
+explain(costs off) select * from test_partition_table where b is null;
+ QUERY PLAN
+------------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> Dynamic Index Scan on part_index_b on test_partition_table
+ Index Cond: (b IS NULL)
+ Number of partitions to scan: 1 (out of 3)
+ Optimizer: GPORCA
+(5 rows)
+
+select * from test_partition_table where b is null;
+ a | b
+---+---
+ 0 |
+(1 row)
+
+explain(costs off) select * from test_partition_table where b is not null;
+ QUERY PLAN
+------------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ -> Dynamic Index Scan on part_index_b on test_partition_table
+ Index Cond: (b IS NOT NULL)
+ Number of partitions to scan: 3 (out of 3)
+ Optimizer: GPORCA
+(5 rows)
+
+select * from test_partition_table where b is not null;
+ a | b
+---+---
+ 2 | 2
+ 4 | 4
+ 3 | 3
+ 1 | 1
+(4 rows)
+
+-- Clean Up
+drop table test_partition_table;
diff --git a/src/test/regress/sql/dpe.sql b/src/test/regress/sql/dpe.sql
index 353b8b7685..5a810e73f4 100644
--- a/src/test/regress/sql/dpe.sql
+++ b/src/test/regress/sql/dpe.sql
@@ -119,10 +119,15 @@ select ptid from pt where ptid in (select tid from t where t1 = 'hello' || tid)
-- start_ignore
-- Known_opt_diff: MPP-21320
-- end_ignore
+-- Disable 'CXformSelect2DynamicIndexGet' to avoid picking Dynamic Index Scan and use this test
+-- to showcase dpe alternative
+select disable_xform('CXformSelect2DynamicIndexGet');
explain (costs off, timing off, summary off, analyze) select * from pt where exists (select 1 from t where tid = ptid and t1 = 'hello' || tid);
select * from pt where exists (select 1 from t where tid = ptid and t1 = 'hello' || tid);
+-- enable xform
+select enable_xform('CXformSelect2DynamicIndexGet');
--
-- group-by on top
--
diff --git a/src/test/regress/sql/qp_indexscan.sql b/src/test/regress/sql/qp_indexscan.sql
index 2c573a14f6..e1c838d5a8 100644
--- a/src/test/regress/sql/qp_indexscan.sql
+++ b/src/test/regress/sql/qp_indexscan.sql
@@ -787,4 +787,270 @@ explain(costs off) select a from part_table1 union all select a from part_table2
-- Clean Up
reset enable_seqscan;
DROP TABLE part_table1;
-DROP TABLE part_table2;
\ No newline at end of file
+DROP TABLE part_table2;
+
+-- Purpose: This section includes tests related to min(), max() aggregates optimization.
+CREATE TABLE min_max_aggregates(a int, b int, c int);
+CREATE INDEX multi_key_index_b_c on min_max_aggregates using btree(b DESC, c);
+ANALYZE min_max_aggregates;
+
+-- Testing min/max functions when table doesn't have any tuples to
+-- ensure they return 1 NULL row indicating no min or max value exists.
+-- This test is eligible for optimization.
+explain(costs off) select min(b) from min_max_aggregates;
+select min(b) from min_max_aggregates;
+explain(costs off) select max(b) from min_max_aggregates;
+select max(b) from min_max_aggregates;
+
+INSERT INTO min_max_aggregates select i, i, i from generate_series(1,100)i;
+INSERT INTO min_max_aggregates values(null, null, null);
+
+-- Creating this index to show that both 'multi_key_index_b_c' and
+-- 'single_key_b_desc' are eligible for min/max on column 'b' and
+-- ORCA picks the lower cost index
+CREATE INDEX single_key_b_desc on min_max_aggregates using btree(b DESC);
+ANALYZE min_max_aggregates;
+
+-- This query is eligible for optimization and it leverages Backward
+-- IndexScan as column 'b' in 'single_key_b_desc' is sorted in
+-- descending order and therefore, minimum value can be found at
+-- the bottom of the index
+explain(costs off) select min(b) from min_max_aggregates;
+select min(b) from min_max_aggregates;
+-- This query is eligible for optimization and it leverages Forward
+-- IndexScan as column 'b' in 'single_key_b_desc' is sorted in
+-- descending order and therefore, maximum value can be found
+-- at the top of the index
+explain(costs off) select max(b) from min_max_aggregates;
+select max(b) from min_max_aggregates;
+
+DROP INDEX single_key_b_desc;
+
+-- Test min/max optimization behavior on index with key direction ASC
+CREATE INDEX single_key_b_asc on min_max_aggregates using btree(b);
+ANALYZE min_max_aggregates;
+
+-- This query is eligible for optimization and it leverages Forward
+-- IndexScan as column 'b' in 'single_key_b_asc' is sorted in
+-- ascending order and therefore, minimum value can be found at the
+-- top of the index
+explain(costs off) select min(b) from min_max_aggregates;
+select min(b) from min_max_aggregates;
+-- This query is eligible for optimization and it leverages Backward
+-- IndexScan as column 'b' in 'single_key_b_asc' is sorted in
+-- ascending order and therefore, maximum value can be found
+-- at the bottom of the index
+explain(costs off) select max(b) from min_max_aggregates;
+select max(b) from min_max_aggregates;
+
+DROP INDEX single_key_b_asc;
+
+-- This query is not eligible for optimization as min/max aggregates
+-- are applied on non-leading keys in the index.
+explain(costs off) select min(c) from min_max_aggregates;
+explain(costs off) select max(c) from min_max_aggregates;
+
+-- This query is not eligible for optimization as min/max aggregates
+-- are applied on non index column.
+explain(costs off) select min(a) from min_max_aggregates;
+explain(costs off) select max(a) from min_max_aggregates;
+
+-- Test min/max on a constant. This query is not eligible for
+-- optimization as it is not necessary for min/max on constants
+explain(costs off) select min(100) from min_max_aggregates;
+explain(costs off) select max(100) from min_max_aggregates;
+
+-- Test min/max optimization behavior with empty group by. This query
+-- is eligible for optimization as it doesn't specify any grouping columns
+explain(costs off) select min(b) from min_max_aggregates group by ();
+select min(b) from min_max_aggregates group by ();
+explain(costs off) select max(b) from min_max_aggregates group by ();
+select max(b) from min_max_aggregates group by ();
+
+-- Test min/max with non-empty group by. This query is not eligible for
+-- optimization as it has grouping columns. This check is made while
+-- computing xform promise by validating size of grouping columns and
+-- there by avoiding application of transform
+explain(costs off) select min(b) from min_max_aggregates group by b;
+explain(costs off) select max(b) from min_max_aggregates group by b;
+
+-- Test min/max optimization with CTE
+
+-- Test min/max optimization when used in CTE producer. This query is
+-- eligible for optimization as producer computes min aggregate on a
+-- btree index key
+explain (costs off) with cte_producer as (select min(b) as min_b from min_max_aggregates) select min_b from cte_producer;
+with cte_producer as (select min(b) as min_b from min_max_aggregates) select min_b from cte_producer;
+
+-- Test min/max optimization when used in CTE consumer. This query is
+-- eligible for optimization as CTE consumer computes min aggregate on a
+-- btree index key projected by CTE producer
+explain (costs off) with cte_consumer as (select b as col_b from min_max_aggregates) select min(col_b) from cte_consumer;
+with cte_consumer as (select b as col_b from min_max_aggregates) select min(col_b) from cte_consumer;
+
+-- Test min/max optimization when used in CTE consumer. This query is not
+-- eligible for optimization, because the subquery projects 'col_b' as 'b/2'
+-- upon which the min is computed, but none of the indices store values
+-- of column 'b/2' so that IndexScan could be used on that index
+explain (costs off) with cte_consumer as (select b/2 as col_b from min_max_aggregates) select min(col_b) from cte_consumer;
+
+-- Test min/max optimization with Casts
+
+-- Case where result of min/max is casted to a different data type.
+-- This query is eligible for optimization as casting happens after
+-- aggregation.
+explain (costs off) select min(b)::int8 from min_max_aggregates;
+select min(b)::int8 from min_max_aggregates;
+
+-- Case where min/max is computed on a column casted to a different data type.
+-- This query is eligible for optimization as column type int4 and casted
+-- type int8 belong to same opfamily
+explain (costs off) select min(b::int8) from min_max_aggregates;
+select min(b::int8) from min_max_aggregates;
+
+-- This query is not eligible for optimization as there is no operator
+-- that handles comparison of a int4 and varchar type
+explain (costs off) select min(b::varchar) from min_max_aggregates;
+
+-- Cases with more than one min/max aggregates in query
+
+-- These queries aren't eligible for optimization because the transform's
+-- pattern only contains a single Scalar Project Element that matches only
+-- a single aggregate function whereas, these queries have more than one
+-- aggregate function. Support for these queries is beyond the scope of
+-- the current PR
+explain(costs off) select min(b), max(b) from min_max_aggregates;
+explain(costs off) select min(a) + max(a) from min_max_aggregates;
+
+-- Clean Up
+drop table min_max_aggregates;
+
+-- Test min/max optimization with union all, subqueries, joins and outer references
+CREATE TABLE table1 (a int, b int, c int);
+CREATE INDEX t1_c_idx on table1 using btree(c);
+CREATE TABLE table2 (a int, b int, c int);
+CREATE INDEX t2_c_idx on table2 using btree(c);
+INSERT INTO table1 select i, i, i from generate_series(1,100) i;
+INSERT INTO table2 select i, i, i from generate_series(1,100) i;
+ANALYZE table1;
+ANALYZE table2;
+
+-- Test min/max optimization when used in subqueries
+
+-- This query is eligible for optimization as subquery computes max
+-- aggregate on a btree index key
+explain (costs off) select b from table1 where c = (select max(c) from table1);
+select b from table1 where c = (select max(c) from table1);
+
+-- Test min/max optimization in a subquery along with a predicate.
+-- This query isn't eligible to use optimization because predicate's
+-- pattern has a Select over LogicalGet and it doesn't match with the
+-- transform's pattern
+explain (costs off) select b, (select min(c) from table1 where table1.a > 5) as min_c from table2;
+
+explain (costs off) select b, (select min(c) from table1 where table1.b = table2.b) as min_c from table2;
+
+-- Test min/max optimization on result of union all present as part of
+-- subquery. This query is not eligible to use min/max optimization as
+-- it performs min/max on result of union all, and not directly on a table's
+-- column due to which there is mismatch in query and transform's pattern.
+-- The query pattern has LogicalUnionAll as first child of GbAgg whereas
+-- transforms pattern has LogicalGet.
+explain (costs off) select max(c) from (select c from table1 union all select c from table2) subquery;
+
+-- Test min/max optimization on outer references.
+
+-- This query is eligible to use optimization as it only has single
+-- aggregate function on an index column
+explain (costs off) select (select b from table1 t1_alias where t1_alias.a = min(t1.c)) as min_val_for_c from table1 t1;
+
+-- This query uses more than one aggregate function, and is not eligible
+-- to use optimization. This is because, query's pattern doesn't
+-- match the transforms pattern of a single Scalar Project Element.
+explain (costs off) select min(t1.c) as min_c,
+ (select b from table1 t1_alias where t1_alias.c = max(t1.c)) as b_val
+ from table1 t1;
+
+-- Test min/max optimization used as part of projected columns in join.
+-- This query is not eligible to use the optimization as it involves
+-- join result which is not guaranteed to be sorted, unless it is an NL join.
+explain (costs off) select min(table1.c) from table1 join table2 on table1.a=table2.a;
+
+-- Clean up
+drop table table1;
+drop table table2;
+
+-- Purpose: This section tests IS NULL/IS NOT NULL predicate on btree and non-index columns
+CREATE TABLE test_nulltype_predicates(a int, b int);
+CREATE INDEX index_b on test_nulltype_predicates using btree(b DESC);
+INSERT INTO test_nulltype_predicates select i, i from generate_series(1,3)i;
+INSERT INTO test_nulltype_predicates values(null, null);
+ANALYZE test_nulltype_predicates;
+
+-- Tests with IS NULL on btree index columns
+explain(costs off) select * from test_nulltype_predicates where b is null;
+select * from test_nulltype_predicates where b is null;
+
+-- Tests with IS NULL on non-index columns
+explain(costs off) select * from test_nulltype_predicates where a is null;
+
+-- Tests with IS NOT NULL on btree index columns
+explain(costs off) select * from test_nulltype_predicates where b is not null;
+select * from test_nulltype_predicates where b is not null;
+
+-- Tests with IS NOT NULL on non-index columns
+explain(costs off) select * from test_nulltype_predicates where a is not null;
+
+-- Clean Up
+drop table test_nulltype_predicates;
+
+-- Purpose: Test min/max optimization on AO table.
+-- IndexOnlyScans are supported but IndexScans aren't supported on AO tables
+CREATE TABLE test_ao_table(a int, b int) WITH (appendonly=true) DISTRIBUTED BY (a);
+CREATE INDEX ao_index_b on test_ao_table using btree(b desc);
+INSERT INTO test_ao_table SELECT i, i from generate_series(1,100) i;
+ANALYZE test_ao_table;
+
+-- Test max() aggregate. This query is eligible to use optimization
+explain(costs off) select max(b) from test_ao_table;
+select max(b) from test_ao_table;
+
+-- Test min() aggregate. This query is eligible to use optimization
+explain(costs off) select min(b) from test_ao_table;
+select min(b) from test_ao_table;
+
+-- Clean Up
+drop table test_ao_table;
+
+
+-- Purpose: Test min/max optimization on partition tables.
+CREATE TABLE test_partition_table(a int, b int) DISTRIBUTED BY (a) PARTITION BY range(b);
+CREATE TABLE partition1 PARTITION OF test_partition_table FOR VALUES FROM (1) TO (3);
+CREATE TABLE partition2 PARTITION OF test_partition_table FOR VALUES FROM (3) TO (6);
+CREATE TABLE default_partition PARTITION OF test_partition_table DEFAULT;
+CREATE INDEX part_index_b on test_partition_table using btree(b desc);
+INSERT INTO test_partition_table SELECT i, i from generate_series(1,4) i;
+-- Insert into default partition to show partition pruning
+-- for IS NULL conditions
+INSERT INTO test_partition_table values (0, NULL);
+ANALYZE test_partition_table;
+
+-- Test min/max aggregate on partition tables. This query is not
+-- eligible for optimization because the query's pattern has LogicalDynamicGet
+-- as first child of LogicalGbAgg whereas transform's pattern has LogicalGet.
+-- Support for these queries is beyond the scope of the current PR.
+explain(costs off) select max(b) from test_partition_table;
+
+explain(costs off) select min(b) from test_partition_table;
+
+-- Test IS NULL, IS NOT NULL on partition table btree index column.
+-- For IS NULL predicate on partition column, pruning happens
+-- whereas, for IS NOT NULL it doesn't because the Non null values
+-- could be in all of the partitions
+explain(costs off) select * from test_partition_table where b is null;
+select * from test_partition_table where b is null;
+explain(costs off) select * from test_partition_table where b is not null;
+select * from test_partition_table where b is not null;
+
+-- Clean Up
+drop table test_partition_table;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org