mirror of https://github.com/citusdata/citus.git
Test that EXPLAIN ANALYZE is not supported for some forms of INSERT/SELECT
parent
f54a8e53c0
commit
02cff1a7c6
|
@ -141,21 +141,23 @@ CoordinatorInsertSelectExplainScan(CustomScanState *node, List *ancestors,
|
||||||
char *queryString = NULL;
|
char *queryString = NULL;
|
||||||
int cursorOptions = CURSOR_OPT_PARALLEL_OK;
|
int cursorOptions = CURSOR_OPT_PARALLEL_OK;
|
||||||
|
|
||||||
if (es->analyze)
|
|
||||||
{
|
|
||||||
/* avoiding double execution here is tricky, error out for now */
|
|
||||||
ereport(ERROR, (errmsg("EXPLAIN ANALYZE is currently not supported for INSERT "
|
|
||||||
"... SELECT commands via the coordinator")));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make a copy of the query, since pg_plan_query may scribble on it and later
|
* Make a copy of the query, since pg_plan_query may scribble on it and later
|
||||||
* stages of EXPLAIN require it.
|
* stages of EXPLAIN require it.
|
||||||
*/
|
*/
|
||||||
Query *queryCopy = copyObject(query);
|
Query *queryCopy = copyObject(query);
|
||||||
PlannedStmt *selectPlan = pg_plan_query(queryCopy, cursorOptions, params);
|
PlannedStmt *selectPlan = pg_plan_query(queryCopy, cursorOptions, params);
|
||||||
if (IsRedistributablePlan(selectPlan->planTree) &&
|
bool repartition = IsRedistributablePlan(selectPlan->planTree) &&
|
||||||
IsSupportedRedistributionTarget(targetRelationId))
|
IsSupportedRedistributionTarget(targetRelationId);
|
||||||
|
|
||||||
|
if (es->analyze)
|
||||||
|
{
|
||||||
|
ereport(ERROR, (errmsg("EXPLAIN ANALYZE is currently not supported for INSERT "
|
||||||
|
"... SELECT commands %s",
|
||||||
|
repartition ? "with repartitioning" : "via coordinator")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (repartition)
|
||||||
{
|
{
|
||||||
ExplainPropertyText("INSERT/SELECT method", "repartition", es);
|
ExplainPropertyText("INSERT/SELECT method", "repartition", es);
|
||||||
}
|
}
|
||||||
|
|
|
@ -573,6 +573,11 @@ EXPLAIN INSERT INTO target_table SELECT a, max(b) FROM source_table GROUP BY a;
|
||||||
-> Seq Scan on source_table_4213606 source_table (cost=0.00..32.60 rows=2260 width=8)
|
-> Seq Scan on source_table_4213606 source_table (cost=0.00..32.60 rows=2260 width=8)
|
||||||
(10 rows)
|
(10 rows)
|
||||||
|
|
||||||
|
--
|
||||||
|
-- EXPLAIN ANALYZE is currently not supported
|
||||||
|
--
|
||||||
|
EXPLAIN ANALYZE INSERT INTO target_table SELECT a, max(b) FROM source_table GROUP BY a;
|
||||||
|
ERROR: EXPLAIN ANALYZE is currently not supported for INSERT ... SELECT commands with repartitioning
|
||||||
--
|
--
|
||||||
-- Duplicate names in target list
|
-- Duplicate names in target list
|
||||||
--
|
--
|
||||||
|
|
|
@ -910,6 +910,14 @@ $Q$);
|
||||||
Task Count: 4
|
Task Count: 4
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
|
-- EXPLAIN ANALYZE is not supported for INSERT ... SELECT via coordinator
|
||||||
|
EXPLAIN (costs off, analyze on)
|
||||||
|
INSERT INTO agg_events (user_id)
|
||||||
|
SELECT
|
||||||
|
raw_events_first.user_id
|
||||||
|
FROM
|
||||||
|
raw_events_first INNER JOIN raw_events_second ON raw_events_first.value_1 = raw_events_second.value_1;
|
||||||
|
ERROR: EXPLAIN ANALYZE is currently not supported for INSERT ... SELECT commands via coordinator
|
||||||
-- even if there is a filter on the partition key, since the join is not on the partition key we reject
|
-- even if there is a filter on the partition key, since the join is not on the partition key we reject
|
||||||
-- this query
|
-- this query
|
||||||
INSERT INTO agg_events (user_id)
|
INSERT INTO agg_events (user_id)
|
||||||
|
|
|
@ -271,6 +271,12 @@ SELECT * FROM target_table ORDER BY a;
|
||||||
|
|
||||||
EXPLAIN INSERT INTO target_table SELECT a, max(b) FROM source_table GROUP BY a;
|
EXPLAIN INSERT INTO target_table SELECT a, max(b) FROM source_table GROUP BY a;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- EXPLAIN ANALYZE is currently not supported
|
||||||
|
--
|
||||||
|
|
||||||
|
EXPLAIN ANALYZE INSERT INTO target_table SELECT a, max(b) FROM source_table GROUP BY a;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Duplicate names in target list
|
-- Duplicate names in target list
|
||||||
--
|
--
|
||||||
|
|
|
@ -677,6 +677,14 @@ SET client_min_messages TO WARNING;
|
||||||
raw_events_first INNER JOIN raw_events_second ON raw_events_first.value_1 = raw_events_second.value_1;
|
raw_events_first INNER JOIN raw_events_second ON raw_events_first.value_1 = raw_events_second.value_1;
|
||||||
$Q$);
|
$Q$);
|
||||||
|
|
||||||
|
-- EXPLAIN ANALYZE is not supported for INSERT ... SELECT via coordinator
|
||||||
|
EXPLAIN (costs off, analyze on)
|
||||||
|
INSERT INTO agg_events (user_id)
|
||||||
|
SELECT
|
||||||
|
raw_events_first.user_id
|
||||||
|
FROM
|
||||||
|
raw_events_first INNER JOIN raw_events_second ON raw_events_first.value_1 = raw_events_second.value_1;
|
||||||
|
|
||||||
-- even if there is a filter on the partition key, since the join is not on the partition key we reject
|
-- even if there is a filter on the partition key, since the join is not on the partition key we reject
|
||||||
-- this query
|
-- this query
|
||||||
INSERT INTO agg_events (user_id)
|
INSERT INTO agg_events (user_id)
|
||||||
|
|
Loading…
Reference in New Issue