diff --git a/src/backend/distributed/executor/adaptive_executor.c b/src/backend/distributed/executor/adaptive_executor.c index 443e9ab2ac5..6b0690712ac 100644 --- a/src/backend/distributed/executor/adaptive_executor.c +++ b/src/backend/distributed/executor/adaptive_executor.c @@ -119,6 +119,7 @@ */ #include +#include #include #include @@ -168,6 +169,7 @@ #include "distributed/placement_connection.h" #include "distributed/relation_access_tracking.h" #include "distributed/remote_commands.h" +#include "distributed/remote_transaction.h" #include "distributed/repartition_join_execution.h" #include "distributed/resource_lock.h" #include "distributed/shared_connection_stats.h" @@ -178,6 +180,7 @@ #include "distributed/transaction_management.h" #include "distributed/tuple_destination.h" #include "distributed/version_compat.h" +#include "distributed/worker_log_messages.h" #include "distributed/worker_protocol.h" #define SLOW_START_DISABLED 0 @@ -552,6 +555,46 @@ int ExecutorBatchSize = 0; int ExecutorChunkSize = 8192; +/* + * SingleTaskExecution holds state that persists across batched calls to + * SingleTaskExecutorRun(). Created in SingleTaskExecutorStart(), freed in + * SingleTaskExecutorEnd(). + */ +typedef struct SingleTaskExecution +{ + /* connection and query state */ + MultiConnection *connection; + bool hasRemoteTask; + + /* result decoding */ + AttInMetadata *attInMetadata; + bool binaryResults; + void **columnArray; + StringInfoData *stringInfoDataArray; + uint32 columnCount; + + /* wait event set for socket polling (lazily created) */ + WaitEventSet *waitEventSet; + + /* per-row scratch context */ + MemoryContext rowContext; + + /* tuple destination */ + TupleDestination *defaultTupleDest; + Task *task; + + /* fetch state */ + bool fetchDone; + uint64 rowsProcessed; + + /* batch size limit */ + int maxBatchSize; + + /* memory context that owns this struct */ + MemoryContext localContext; +} SingleTaskExecution; + + /* * TaskExecutionState indicates whether or not a command on a shard * has finished, or whether it has failed. @@ -702,7 +745,7 @@ static void RunDistributedExecution(DistributedExecution *execution, bool toComp static void SequentialRunDistributedExecution(DistributedExecution *execution); static void FinishDistributedExecution(DistributedExecution *execution); static void CleanUpSessions(DistributedExecution *execution); -static int CalculateMaxBatchSize(TupleDesc tupleDescriptor); +int CalculateMaxBatchSize(TupleDesc tupleDescriptor); static bool DistributedExecutionModifiesDatabase(DistributedExecution *execution); static void AssignTasksToConnectionsOrWorkerPool(DistributedExecution *execution); @@ -1164,7 +1207,7 @@ EagerAdaptiveExecutor(CitusScanState *scanState) * before the batch limit is re-checked, so the actual number of rows * in the tuplestore may exceed maxBatchSize by up to one chunk. */ -static int +int CalculateMaxBatchSize(TupleDesc tupleDescriptor) { if (ExecutorBatchSize > 0) @@ -1213,6 +1256,597 @@ CalculateMaxBatchSize(TupleDesc tupleDescriptor) } +/* + * OneTaskNoOpNoticeReceiver is a PQnoticeReceiver that silently discards all + * messages. It is installed temporarily on a cached connection while the + * SingleTaskExecutor probes for a dead connection (e.g. one whose + * worker backend was terminated). Without this, a buffered FATAL error + * would be forwarded through Citus's DefaultCitusNoticeReceiver which + * calls ereport(FATAL) and kills the coordinator backend. + */ +static void +OneTaskNoOpNoticeReceiver(void *arg, const PGresult *result) +{ + /* intentionally blank */ +} + + +/* + * SingleTaskExecutorStart sets up the single-task execution: creates the + * tuplestore, handles transaction setup, acquires locks, splits local/remote + * tasks, runs local tasks immediately, establishes the remote connection, + * sends the query, and enters single-row mode. All persistent state is + * stored in scanState->singleTaskState for subsequent Run/End calls. + */ +void +SingleTaskExecutorStart(CitusScanState *scanState) +{ + DistributedPlan *distributedPlan = scanState->distributedPlan; + EState *executorState = ScanStateGetExecutorState(scanState); + ParamListInfo paramListInfo = executorState->es_param_list_info; + Job *job = distributedPlan->workerJob; + List *taskList = job->taskList; + + MemoryContext localContext = + AllocSetContextCreate(CurrentMemoryContext, + "SingleTaskExecutor", + ALLOCSET_DEFAULT_SIZES); + MemoryContext oldContext = MemoryContextSwitchTo(localContext); + + /* allocate and zero the persistent state */ + SingleTaskExecution *ste = palloc0(sizeof(SingleTaskExecution)); + ste->localContext = localContext; + ste->fetchDone = true; /* assume done unless we set up a remote task */ + scanState->singleTaskState = ste; + + /* set up the tuplestore for results */ + bool randomAccess = true; + bool interTransactions = false; + scanState->tuplestorestate = + tuplestore_begin_heap(randomAccess, interTransactions, work_mem); + + TupleDesc tupleDescriptor = ScanStateGetTupleDescriptor(scanState); + ste->defaultTupleDest = + CreateTupleStoreTupleDest(scanState->tuplestorestate, tupleDescriptor); + + /* compute batch size from GUC or work_mem */ + ste->maxBatchSize = CalculateMaxBatchSize(tupleDescriptor); + + /* decide transaction properties */ + bool excludeFromXact = false; + TransactionProperties xactProperties = + DecideTaskListTransactionProperties(distributedPlan->modLevel, + taskList, excludeFromXact); + + /* copy and mark unreferenced params (skip for dynamic param fetch) */ + if (paramListInfo != NULL && !paramListInfo->paramFetch) + { + paramListInfo = copyParamList(paramListInfo); + MarkUnreferencedExternParams((Node *) job->jobQuery, paramListInfo); + } + + /* set up coordinated transaction / 2PC if needed */ + if (xactProperties.useRemoteTransactionBlocks == TRANSACTION_BLOCKS_REQUIRED) + { + UseCoordinatedTransaction(); + } + + if (xactProperties.requires2PC) + { + Use2PCForCoordinatedTransaction(); + } + + /* acquire shard locks */ + AcquireExecutorShardLocksForExecution(distributedPlan->modLevel, taskList); + + /* handle 0-task case (e.g., DELETE with non-existent dist key) */ + if (taskList == NIL) + { + MemoryContextSwitchTo(oldContext); + return; + } + + /* split into local and remote tasks */ + List *localTaskList = NIL; + List *remoteTaskList = NIL; + bool localExecutionSupported = true; + + if (localExecutionSupported && ShouldExecuteTasksLocally(taskList)) + { + bool readOnlyPlan = !TaskListModifiesDatabase(distributedPlan->modLevel, + taskList); + ExtractLocalAndRemoteTasks(readOnlyPlan, taskList, + &localTaskList, &remoteTaskList); + } + else + { + remoteTaskList = taskList; + } + + /* execute local tasks if any (run to completion, no batching needed) */ + if (localTaskList != NIL) + { + uint64 localRowsProcessed = + ExecuteLocalTaskListExtended(localTaskList, + executorState->es_param_list_info, + distributedPlan, ste->defaultTupleDest, + false); + + CmdType commandType = job->jobQuery->commandType; + if (commandType != CMD_SELECT) + { + executorState->es_processed += localRowsProcessed; + } + } + + /* set up remote execution if needed */ + if (remoteTaskList == NIL) + { + /* local-only: mark modification level now that execution is done */ + if (TaskListModifiesDatabase(distributedPlan->modLevel, taskList)) + { + XactModificationLevel = XACT_MODIFICATION_DATA; + } + + MemoryContextSwitchTo(oldContext); + return; + } + + ste->hasRemoteTask = true; + ste->fetchDone = false; + + Task *task = (Task *) linitial(remoteTaskList); + ste->task = task; + ShardPlacement *taskPlacement = (ShardPlacement *) linitial( + task->taskPlacementList); + + /* ensure we're allowed to do remote execution */ + bool isRemote = true; + EnsureTaskExecutionAllowed(isRemote); + + /* look up the target node */ + char *nodeName = NULL; + int nodePort = 0; + LookupTaskPlacementHostAndPort(taskPlacement, &nodeName, &nodePort); + + /* build placement access list for connection reuse tracking */ + List *placementAccessList = PlacementAccessListForTask(task, taskPlacement); + + /* try to reuse a connection from the current transaction */ + int connectionFlags = 0; + MultiConnection *connection = NULL; + + if (xactProperties.useRemoteTransactionBlocks != TRANSACTION_BLOCKS_DISALLOWED) + { + connection = GetConnectionIfPlacementAccessedInXact( + connectionFlags, placementAccessList, NULL); + } + + if (connection == NULL) + { + connection = GetNodeUserDatabaseConnection( + connectionFlags, nodeName, nodePort, NULL, NULL); + + if (PQstatus(connection->pgConn) != CONNECTION_OK) + { + ReportConnectionError(connection, ERROR); + } + } + + /* + * Detect remotely closed/terminated cached connections before + * attempting to use them. + */ + if (connection->remoteTransaction.transactionState == REMOTE_TRANS_NOT_STARTED) + { + bool connectionDead = false; + int sock = PQsocket(connection->pgConn); + + if (sock >= 0) + { + char peekBuf; + ssize_t peekRc = recv(sock, &peekBuf, 1, + MSG_PEEK | MSG_DONTWAIT); + + if (peekRc == 0) + { + connectionDead = true; + } + else if (peekRc > 0) + { + PQsetNoticeReceiver(connection->pgConn, + OneTaskNoOpNoticeReceiver, NULL); + PQconsumeInput(connection->pgConn); + SetCitusNoticeReceiver(connection); + connectionDead = true; + } + else if (errno != EAGAIN && errno != EWOULDBLOCK) + { + connectionDead = true; + } + } + + if (connectionDead) + { + CloseConnection(connection); + + connection = GetNodeUserDatabaseConnection( + connectionFlags, nodeName, nodePort, NULL, NULL); + + if (PQstatus(connection->pgConn) != CONNECTION_OK) + { + ReportConnectionError(connection, ERROR); + } + + placementAccessList = PlacementAccessListForTask(task, taskPlacement); + } + } + + ClaimConnectionExclusively(connection); + AssignPlacementListToConnection(placementAccessList, connection); + ste->connection = connection; + + /* + * Activate 2PC if this modifying transaction expands to a new node. + */ + if (xactProperties.useRemoteTransactionBlocks == TRANSACTION_BLOCKS_REQUIRED && + XactModificationLevel == XACT_MODIFICATION_DATA && + TaskListModifiesDatabase(distributedPlan->modLevel, taskList) && + !ConnectionModifiedPlacement(connection)) + { + Use2PCForCoordinatedTransaction(); + } + + if (xactProperties.useRemoteTransactionBlocks == TRANSACTION_BLOCKS_REQUIRED) + { + RemoteTransactionBeginIfNecessary(connection); + } + + /* send the query */ + char *queryString = TaskQueryStringAtIndex(task, 0); + int querySent = 0; + bool binaryResults = false; + + if (EnableBinaryProtocol && tupleDescriptor != NULL && + CanUseBinaryCopyFormat(tupleDescriptor)) + { + binaryResults = true; + } + ste->binaryResults = binaryResults; + + if (paramListInfo != NULL && !task->parametersInQueryStringResolved) + { + int parameterCount = paramListInfo->numParams; + Oid *parameterTypes = NULL; + const char **parameterValues = NULL; + + paramListInfo = copyParamList(paramListInfo); + ExtractParametersForRemoteExecution(paramListInfo, ¶meterTypes, + ¶meterValues); + querySent = SendRemoteCommandParams(connection, queryString, + parameterCount, parameterTypes, + parameterValues, binaryResults); + } + else + { + if (!binaryResults) + { + querySent = SendRemoteCommand(connection, queryString); + } + else + { + querySent = SendRemoteCommandParams(connection, queryString, + 0, NULL, NULL, binaryResults); + } + } + + if (querySent == 0) + { + UnclaimConnection(connection); + ste->connection = NULL; + ereport(ERROR, + (errmsg("failed to send query to %s:%d", + nodeName, nodePort))); + } + + if (PQsetSingleRowMode(connection->pgConn) == 0) + { + UnclaimConnection(connection); + ste->connection = NULL; + ereport(ERROR, + (errmsg("failed to set single-row mode for %s:%d", + nodeName, nodePort))); + } + + /* set up result decoding */ + if (tupleDescriptor != NULL) + { + if (binaryResults) + { + ste->attInMetadata = TupleDescGetAttBinaryInMetadata(tupleDescriptor); + } + else + { + ste->attInMetadata = TupleDescGetAttInMetadata(tupleDescriptor); + } + } + + ste->columnCount = (tupleDescriptor != NULL) ? + tupleDescriptor->natts : 16; + ste->columnArray = palloc0(ste->columnCount * sizeof(void *)); + + if (EnableBinaryProtocol && binaryResults) + { + ste->stringInfoDataArray = palloc0(ste->columnCount * + sizeof(StringInfoData)); + for (uint32 i = 0; i < ste->columnCount; i++) + { + initStringInfo(&ste->stringInfoDataArray[i]); + } + } + + ste->rowContext = AllocSetContextCreate(localContext, + "RowContext", + ALLOCSET_DEFAULT_MINSIZE, + ALLOCSET_DEFAULT_INITSIZE, + ALLOCSET_DEFAULT_MAXSIZE); + + MemoryContextSwitchTo(oldContext); +} + + +/* + * SingleTaskExecutorRun fetches up to maxBatchSize rows from the remote + * connection into the tuplestore. Returns true when all results have been + * consumed (fetch complete). Called repeatedly from CitusExecOneTaskScan. + * + * For DML (PGRES_COMMAND_OK), this processes the command completion in a + * single call and returns true. + */ +bool +SingleTaskExecutorRun(CitusScanState *scanState) +{ + SingleTaskExecution *ste = scanState->singleTaskState; + if (ste == NULL || ste->fetchDone || !ste->hasRemoteTask) + { + return true; + } + + EState *executorState = ScanStateGetExecutorState(scanState); + TupleDesc tupleDescriptor = ScanStateGetTupleDescriptor(scanState); + MultiConnection *connection = ste->connection; + int batchRowCount = 0; + + MemoryContext oldContext = MemoryContextSwitchTo(ste->localContext); + + while (!ste->fetchDone) + { + /* wait for the socket to be readable if busy */ + if (PQisBusy(connection->pgConn)) + { + if (ste->waitEventSet == NULL) + { + int sock = PQsocket(connection->pgConn); + if (sock == PGINVALID_SOCKET) + { + ereport(ERROR, + (errmsg("connection lost during single-task execution"))); + } + ste->waitEventSet = CreateWaitEventSet(WaitEventSetTracker_compat, 3); + AddWaitEventToSet(ste->waitEventSet, WL_LATCH_SET, + PGINVALID_SOCKET, MyLatch, NULL); + AddWaitEventToSet(ste->waitEventSet, WL_EXIT_ON_PM_DEATH, + PGINVALID_SOCKET, NULL, NULL); + AddWaitEventToSet(ste->waitEventSet, WL_SOCKET_READABLE, + sock, NULL, NULL); + } + + WaitEvent event; + int rc = WaitEventSetWait(ste->waitEventSet, -1, &event, 1, + PG_WAIT_EXTENSION); + + ResetLatch(MyLatch); + CHECK_FOR_INTERRUPTS(); + + if (rc > 0 && (event.events & WL_SOCKET_READABLE)) + { + if (!PQconsumeInput(connection->pgConn)) + { + ereport(ERROR, + (errmsg("failed to receive data during single-task execution") + )); + } + } + + continue; + } + + PGresult *result = PQgetResult(connection->pgConn); + if (result == NULL) + { + ste->fetchDone = true; + break; + } + + ExecStatusType resultStatus = PQresultStatus(result); + + if (resultStatus == PGRES_COMMAND_OK) + { + char *currentAffectedTupleString = PQcmdTuples(result); + if (*currentAffectedTupleString != '\0') + { + ste->rowsProcessed += pg_strtoint64(currentAffectedTupleString); + } + PQclear(result); + continue; + } + else if (resultStatus == PGRES_TUPLES_OK) + { + PQclear(result); + continue; + } + else if (resultStatus != PGRES_SINGLE_TUPLE) + { + ReportResultError(connection, result, ERROR); + } + + if (tupleDescriptor == NULL) + { + PQclear(result); + continue; + } + + /* process rows from this result */ + uint32 ntuples = PQntuples(result); + uint32 columnCount = PQnfields(result); + + if (columnCount != (uint32) tupleDescriptor->natts) + { + ereport(ERROR, + (errmsg("unexpected number of columns from worker: %d, " + "expected %d", + columnCount, tupleDescriptor->natts))); + } + + for (uint32 rowIndex = 0; rowIndex < ntuples; rowIndex++) + { + MemoryContext prevContext = MemoryContextSwitchTo(ste->rowContext); + + memset(ste->columnArray, 0, columnCount * sizeof(void *)); + + for (uint32 colIndex = 0; colIndex < columnCount; colIndex++) + { + if (PQgetisnull(result, rowIndex, colIndex)) + { + ste->columnArray[colIndex] = NULL; + } + else + { + int valueLength = PQgetlength(result, rowIndex, colIndex); + char *value = PQgetvalue(result, rowIndex, colIndex); + + if (ste->binaryResults) + { + resetStringInfo(&ste->stringInfoDataArray[colIndex]); + appendBinaryStringInfo(&ste->stringInfoDataArray[colIndex], + value, valueLength); + ste->columnArray[colIndex] = &ste->stringInfoDataArray[colIndex]; + } + else + { + ste->columnArray[colIndex] = value; + } + } + } + + HeapTuple heapTuple; + if (ste->binaryResults) + { + heapTuple = BuildTupleFromBytes(ste->attInMetadata, + (fmStringInfo *) ste->columnArray); + } + else + { + heapTuple = BuildTupleFromCStrings(ste->attInMetadata, + (char **) ste->columnArray); + } + + MemoryContextSwitchTo(prevContext); + + TupleDestination *tupleDest = ste->task->tupleDest ? + ste->task->tupleDest : ste->defaultTupleDest; + tupleDest->putTuple(tupleDest, ste->task, 0, 0, heapTuple, 0); + + MemoryContextReset(ste->rowContext); + + ste->rowsProcessed++; + batchRowCount++; + } + + PQclear(result); + + /* check batch limit */ + if (batchRowCount >= ste->maxBatchSize) + { + break; + } + } + + /* update es_processed for DML */ + if (ste->fetchDone) + { + CmdType commandType = scanState->distributedPlan->workerJob->jobQuery->commandType + ; + if (commandType != CMD_SELECT) + { + executorState->es_processed += ste->rowsProcessed; + } + + /* mark the transaction as having modified data */ + if (TaskListModifiesDatabase(scanState->distributedPlan->modLevel, + scanState->distributedPlan->workerJob->taskList)) + { + XactModificationLevel = XACT_MODIFICATION_DATA; + } + } + + MemoryContextSwitchTo(oldContext); + return ste->fetchDone; +} + + +/* + * SingleTaskExecutorEnd cleans up the single-task execution state. + * Called from CitusEndScan. If the fetch is not yet complete (e.g. LIMIT + * was satisfied), cancels the in-flight query and drains results before + * releasing the connection. + */ +void +SingleTaskExecutorEnd(CitusScanState *scanState) +{ + SingleTaskExecution *ste = scanState->singleTaskState; + if (ste == NULL) + { + return; + } + + /* cancel and drain if fetch was interrupted (e.g. LIMIT) */ + if (!ste->fetchDone && ste->connection != NULL) + { + PGconn *pgConn = ste->connection->pgConn; + + if (pgConn != NULL && + PQstatus(pgConn) == CONNECTION_OK && + PQtransactionStatus(pgConn) == PQTRANS_ACTIVE) + { + SendCancelationRequest(ste->connection); + } + + ClearResultsDiscardWarnings(ste->connection, false); + } + + if (ste->waitEventSet != NULL) + { + FreeWaitEventSet(ste->waitEventSet); + ste->waitEventSet = NULL; + } + + if (ste->connection != NULL) + { + UnclaimConnection(ste->connection); + ste->connection = NULL; + } + + if (ste->rowContext != NULL) + { + MemoryContextDelete(ste->rowContext); + ste->rowContext = NULL; + } + + scanState->singleTaskState = NULL; +} + + /* * RunLocalExecution runs the localTaskList in the execution, fills the tuplestore * and sets the es_processed if necessary. diff --git a/src/backend/distributed/executor/citus_custom_scan.c b/src/backend/distributed/executor/citus_custom_scan.c index 87fca7422b1..d8599aeff56 100644 --- a/src/backend/distributed/executor/citus_custom_scan.c +++ b/src/backend/distributed/executor/citus_custom_scan.c @@ -44,6 +44,7 @@ #include "distributed/merge_executor.h" #include "distributed/merge_planner.h" #include "distributed/multi_executor.h" +#include "distributed/multi_explain.h" #include "distributed/multi_router_planner.h" #include "distributed/multi_server_executor.h" #include "distributed/shard_utils.h" @@ -60,6 +61,7 @@ extern AllowedDistributionColumn AllowedDistributionColumnValue; /* functions for creating custom scan nodes */ static Node * AdaptiveExecutorCreateScan(CustomScan *scan); static Node * SortedMergeCreateScan(CustomScan *scan); +static Node * SingleTaskExecutorCreateScan(CustomScan *scan); static Node * NonPushableInsertSelectCreateScan(CustomScan *scan); static Node * DelayedErrorCreateScan(CustomScan *scan); static Node * NonPushableMergeCommandCreateScan(CustomScan *scan); @@ -69,6 +71,7 @@ static void CitusBeginScan(CustomScanState *node, EState *estate, int eflags); static void CitusBeginReadOnlyScan(CustomScanState *node, EState *estate, int eflags); static void CitusBeginModifyScan(CustomScanState *node, EState *estate, int eflags); static void CitusPreExecScan(CitusScanState *scanState); +static TupleTableSlot * CitusExecOneTaskScan(CustomScanState *node); static bool ModifyJobNeedsEvaluation(Job *workerJob); static void RegenerateTaskForFasthPathQuery(Job *workerJob); static void RegenerateTaskListForInsert(Job *workerJob); @@ -99,6 +102,11 @@ CustomScanMethods SortedMergeCustomScanMethods = { SortedMergeCreateScan }; +CustomScanMethods SingleTaskExecutorCustomScanMethods = { + "Citus Single Task", + SingleTaskExecutorCreateScan +}; + CustomScanMethods NonPushableInsertSelectCustomScanMethods = { "Citus INSERT ... SELECT", NonPushableInsertSelectCreateScan @@ -127,6 +135,15 @@ static CustomExecMethods AdaptiveExecutorCustomExecMethods = { .ExplainCustomScan = CitusExplainScan }; +static CustomExecMethods SingleTaskExecutorCustomExecMethods = { + .CustomName = "SingleTaskExecutorScan", + .BeginCustomScan = CitusBeginScan, + .ExecCustomScan = CitusExecOneTaskScan, + .EndCustomScan = CitusEndScan, + .ReScanCustomScan = CitusReScan, + .ExplainCustomScan = CitusExplainScan +}; + static CustomExecMethods NonPushableInsertSelectCustomExecMethods = { .CustomName = "NonPushableInsertSelectScan", .BeginCustomScan = CitusBeginScan, @@ -179,6 +196,7 @@ IsCitusCustomState(PlanState *planState) CustomScanState *css = castNode(CustomScanState, planState); if (css->methods == &AdaptiveExecutorCustomExecMethods || css->methods == &SortedMergeCustomExecMethods || + css->methods == &SingleTaskExecutorCustomExecMethods || css->methods == &NonPushableInsertSelectCustomExecMethods || css->methods == &NonPushableMergeCommandCustomExecMethods) { @@ -197,6 +215,7 @@ RegisterCitusCustomScanMethods(void) { RegisterCustomScanMethods(&AdaptiveExecutorCustomScanMethods); RegisterCustomScanMethods(&SortedMergeCustomScanMethods); + RegisterCustomScanMethods(&SingleTaskExecutorCustomScanMethods); RegisterCustomScanMethods(&NonPushableInsertSelectCustomScanMethods); RegisterCustomScanMethods(&DelayedErrorCustomScanMethods); RegisterCustomScanMethods(&NonPushableMergeCommandCustomScanMethods); @@ -335,6 +354,58 @@ CitusExecScan(CustomScanState *node) } +/* + * CitusExecOneTaskScan is the ExecCustomScan callback for the single-task + * executor. On the first call it sets up execution via SingleTaskExecutorStart. + * Each call fetches a batch of rows into the tuplestore and returns one tuple. + * When the tuplestore is drained, it fetches the next batch. This keeps memory + * bounded by work_mem for large result sets. + * + * Falls back to the full AdaptiveExecutor for EXPLAIN ANALYZE. + */ +static TupleTableSlot * +CitusExecOneTaskScan(CustomScanState *node) +{ + CitusScanState *scanState = (CitusScanState *) node; + + if (!scanState->executionStarted) + { + if (RequestedForExplainAnalyze(scanState)) + { + EagerAdaptiveExecutor(scanState); + scanState->finishedRemoteScan = true; + } + else + { + SingleTaskExecutorStart(scanState); + + /* fetch first batch */ + scanState->finishedRemoteScan = SingleTaskExecutorRun(scanState); + } + + if (!scanState->distributedPlan->disableTrackingQueryCounters) + { + IncrementStatCounterForMyDb(STAT_QUERY_EXECUTION_SINGLE_SHARD); + } + + scanState->executionStarted = true; + } + + TupleTableSlot *resultSlot = ReturnTupleFromTuplestore(scanState); + + if (TupIsNull(resultSlot) && !scanState->finishedRemoteScan) + { + tuplestore_clear(scanState->tuplestorestate); + + scanState->finishedRemoteScan = SingleTaskExecutorRun(scanState); + + resultSlot = ReturnTupleFromTuplestore(scanState); + } + + return resultSlot; +} + + /* * CitusBeginReadOnlyScan handles deferred pruning and plan caching for SELECTs. */ @@ -805,6 +876,30 @@ SortedMergeCreateScan(CustomScan *scan) } +/* + * SingleTaskExecutorCreateScan creates the scan state for the + * single-task executor, used for single-shard fast-path queries. + */ +static Node * +SingleTaskExecutorCreateScan(CustomScan *scan) +{ + CitusScanState *scanState = palloc0(sizeof(CitusScanState)); + + /* reuse MULTI_EXECUTOR_ADAPTIVE for stats bucketing (see Research ยง6.1) */ + scanState->executorType = MULTI_EXECUTOR_ADAPTIVE; + scanState->customScanState.ss.ps.type = T_CustomScanState; + scanState->distributedPlan = GetDistributedPlan(scan); + + scanState->customScanState.methods = &SingleTaskExecutorCustomExecMethods; + scanState->PreExecScan = &CitusPreExecScan; + + scanState->finishedPreScan = false; + scanState->finishedRemoteScan = false; + + return (Node *) scanState; +} + + /* * NonPushableInsertSelectCrateScan creates the scan state for executing * INSERT..SELECT into a distributed table via the coordinator. @@ -943,6 +1038,12 @@ CitusEndScan(CustomScanState *node) * ensuring sessions and connections are properly released. */ AdaptiveExecutorEnd(scanState); + + /* + * Clean up single-task execution state. Handles LIMIT / early + * termination by cancelling in-flight queries and draining results. + */ + SingleTaskExecutorEnd(scanState); } diff --git a/src/backend/distributed/executor/multi_server_executor.c b/src/backend/distributed/executor/multi_server_executor.c index 839fcb8ea08..e0a04b3f919 100644 --- a/src/backend/distributed/executor/multi_server_executor.c +++ b/src/backend/distributed/executor/multi_server_executor.c @@ -25,10 +25,12 @@ #include "distributed/coordinator_protocol.h" #include "distributed/listutils.h" #include "distributed/log_utils.h" +#include "distributed/metadata_cache.h" #include "distributed/multi_executor.h" #include "distributed/multi_physical_planner.h" #include "distributed/multi_router_planner.h" #include "distributed/multi_server_executor.h" +#include "distributed/shardinterval_utils.h" #include "distributed/subplan_execution.h" #include "distributed/tuple_destination.h" #include "distributed/worker_protocol.h" @@ -36,6 +38,7 @@ int RemoteTaskCheckInterval = 10; /* per cycle sleep interval in millisecs */ int TaskExecutorType = MULTI_EXECUTOR_ADAPTIVE; /* distributed executor type */ bool EnableRepartitionJoins = false; +bool EnableSingleTaskExecution = true; /* @@ -99,6 +102,42 @@ JobExecutorType(DistributedPlan *distributedPlan) } } - return distributedPlan->useSortedMerge ? MULTI_EXECUTOR_SORTED_MERGE : - MULTI_EXECUTOR_ADAPTIVE; + if (EnableSingleTaskExecution && + distributedPlan->fastPathRouterPlan && + list_length(job->dependentJobList) == 0 && + !IsMultiRowInsert(job->jobQuery) && + !(distributedPlan->modLevel > ROW_MODIFY_READONLY && + IsCitusTableType(distributedPlan->targetRelationId, REFERENCE_TABLE))) + { + /* + * We get the relation OID from the task's relationShardList rather + * than distributedPlan->relationIdList because the latter may contain + * shard OIDs after CheckAndBuildDelayedFastPathPlan() replaces the + * shell table OID with the shard OID for local execution plans. + */ + Oid relationId = distributedPlan->targetRelationId; + if (!OidIsValid(relationId) && list_length(job->taskList) == 1) + { + Task *task = (Task *) linitial(job->taskList); + if (list_length(task->relationShardList) > 0) + { + RelationShard *rs = (RelationShard *) linitial( + task->relationShardList); + relationId = rs->relationId; + } + } + + if (!OidIsValid(relationId) || + SingleReplicatedTable(relationId)) + { + return MULTI_EXECUTOR_SINGLE_TASK; + } + } + + if (distributedPlan->useSortedMerge) + { + return MULTI_EXECUTOR_SORTED_MERGE; + } + + return MULTI_EXECUTOR_ADAPTIVE; } diff --git a/src/backend/distributed/planner/distributed_planner.c b/src/backend/distributed/planner/distributed_planner.c index 446d494a808..ac01f6e6d80 100644 --- a/src/backend/distributed/planner/distributed_planner.c +++ b/src/backend/distributed/planner/distributed_planner.c @@ -1485,6 +1485,12 @@ FinalizePlan(PlannedStmt *localPlan, DistributedPlan *distributedPlan, break; } + case MULTI_EXECUTOR_SINGLE_TASK: + { + customScan->methods = &SingleTaskExecutorCustomScanMethods; + break; + } + case MULTI_EXECUTOR_NON_PUSHABLE_INSERT_SELECT: { customScan->methods = &NonPushableInsertSelectCustomScanMethods; diff --git a/src/backend/distributed/shared_library_init.c b/src/backend/distributed/shared_library_init.c index 9ea35038f8e..a1e910cbf50 100644 --- a/src/backend/distributed/shared_library_init.c +++ b/src/backend/distributed/shared_library_init.c @@ -1607,6 +1607,19 @@ RegisterCitusConfigVariables(void) GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE, NULL, NULL, NULL); + DefineCustomBoolVariable( + "citus.enable_single_task_execution", + gettext_noop("Enables the optimized single-task executor for " + "fast-path router queries."), + gettext_noop("When enabled, single-shard fast-path queries use a " + "streamlined executor that bypasses connection pool " + "management and wait event set overhead."), + &EnableSingleTaskExecution, + true, + PGC_USERSET, + GUC_STANDARD, + NULL, NULL, NULL); + DefineCustomBoolVariable( "citus.enable_sorted_merge", gettext_noop("Enables sorted merge of worker results for ORDER BY queries."), diff --git a/src/include/distributed/adaptive_executor.h b/src/include/distributed/adaptive_executor.h index f404c55058b..50f848b0061 100644 --- a/src/include/distributed/adaptive_executor.h +++ b/src/include/distributed/adaptive_executor.h @@ -32,7 +32,10 @@ extern uint64 ExecuteUtilityTaskListExtended(List *utilityTaskList, int poolSize bool localExecutionSupported); extern uint64 ExecuteTaskListOutsideTransaction(RowModifyLevel modLevel, List *taskList, int targetPoolSize, List *jobIdList); - extern void EagerAdaptiveExecutor(CitusScanState *scanState); +extern void SingleTaskExecutorStart(CitusScanState *scanState); +extern bool SingleTaskExecutorRun(CitusScanState *scanState); +extern void SingleTaskExecutorEnd(CitusScanState *scanState); +extern int CalculateMaxBatchSize(TupleDesc tupleDescriptor); #endif /* ADAPTIVE_EXECUTOR_H */ diff --git a/src/include/distributed/citus_custom_scan.h b/src/include/distributed/citus_custom_scan.h index 1c74da08756..d328e3e7a7a 100644 --- a/src/include/distributed/citus_custom_scan.h +++ b/src/include/distributed/citus_custom_scan.h @@ -17,6 +17,7 @@ #include "distributed/multi_server_executor.h" struct DistributedExecution; +struct SingleTaskExecution; typedef struct CitusScanState { @@ -37,6 +38,9 @@ typedef struct CitusScanState /* execution state when using adaptive executor */ struct DistributedExecution *execution; + + /* execution state when using single-task executor */ + struct SingleTaskExecution *singleTaskState; } CitusScanState; @@ -46,6 +50,7 @@ extern CustomScanMethods SortedMergeCustomScanMethods; extern CustomScanMethods NonPushableInsertSelectCustomScanMethods; extern CustomScanMethods DelayedErrorCustomScanMethods; extern CustomScanMethods NonPushableMergeCommandCustomScanMethods; +extern CustomScanMethods SingleTaskExecutorCustomScanMethods; extern void RegisterCitusCustomScanMethods(void); diff --git a/src/include/distributed/multi_server_executor.h b/src/include/distributed/multi_server_executor.h index 03070e713fd..9f563c28aff 100644 --- a/src/include/distributed/multi_server_executor.h +++ b/src/include/distributed/multi_server_executor.h @@ -31,7 +31,8 @@ typedef enum MULTI_EXECUTOR_ADAPTIVE = 1, MULTI_EXECUTOR_NON_PUSHABLE_INSERT_SELECT = 2, MULTI_EXECUTOR_NON_PUSHABLE_MERGE_QUERY = 3, - MULTI_EXECUTOR_SORTED_MERGE = 4 + MULTI_EXECUTOR_SORTED_MERGE = 4, + MULTI_EXECUTOR_SINGLE_TASK = 5 } MultiExecutorType; @@ -39,6 +40,7 @@ typedef enum extern int RemoteTaskCheckInterval; extern int TaskExecutorType; extern bool EnableRepartitionJoins; +extern bool EnableSingleTaskExecution; extern int MultiTaskQueryLogLevel; diff --git a/src/test/regress/bin/normalize.sed b/src/test/regress/bin/normalize.sed index c470d6cf049..46b9c497b44 100644 --- a/src/test/regress/bin/normalize.sed +++ b/src/test/regress/bin/normalize.sed @@ -287,6 +287,17 @@ s/improvement of 0.1[0-9]* is lower/improvement of 0.1xxxxx is lower/g # normalize tenants statistics annotations s/\/\*\{"cId":.*\*\///g +# normalize repartition hash boundaries in worker_partition_query_result calls +# (partition count varies by number of readable nodes in the cluster) +/worker_partition_query_result/s/'\{[0-9,-]+\}'::text\[\]/'{...}'::text[]/g + +# normalize repartition partition index suffix (varies by node count) +s/repartition_([0-9]+_[0-9]+)_[0-9]+/repartition_\1_N/g + +# normalize shard IDs in the 1470xxx range (used by local_shard_execution tests) +# shard-to-worker placement varies depending on which schedule runs before the test +s/_147[0-9]{4}/_xxxxxxx/g + # Notice message that contains current columnar version that makes it harder to bump versions s/(NOTICE: issuing CREATE EXTENSION IF NOT EXISTS citus_columnar WITH SCHEMA pg_catalog VERSION )"[0-9]+\.[0-9]+-[0-9]+"/\1 "x.y-z"/ diff --git a/src/test/regress/citus_tests/run_test.py b/src/test/regress/citus_tests/run_test.py index 51c371a67cf..ecdac410c97 100755 --- a/src/test/regress/citus_tests/run_test.py +++ b/src/test/regress/citus_tests/run_test.py @@ -130,6 +130,7 @@ def extra_tests(self): "multi_test_catalog_views": TestDeps(None), "multi_insert_select": TestDeps("base_schedule"), "multi_partitioning": TestDeps("base_schedule"), + "multi_transaction_recovery": TestDeps("minimal_schedule"), "multi_mx_create_table": TestDeps( None, [ diff --git a/src/test/regress/expected/coordinator_shouldhaveshards.out b/src/test/regress/expected/coordinator_shouldhaveshards.out index 9ae64fe67ec..cead362c82b 100644 --- a/src/test/regress/expected/coordinator_shouldhaveshards.out +++ b/src/test/regress/expected/coordinator_shouldhaveshards.out @@ -115,8 +115,8 @@ NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (1 (1 row) INSERT INTO repart_test (x, y) SELECT y, x FROM test; -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1503000_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1503000_to','SELECT y AS x, x AS y FROM coordinator_shouldhaveshards.test_1503000 test WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1503003_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1503003_to','SELECT y AS x, x AS y FROM coordinator_shouldhaveshards.test_1503003 test WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1503000_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1503000_to','SELECT y AS x, x AS y FROM coordinator_shouldhaveshards.test_1503000 test WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1503003_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1503003_to','SELECT y AS x, x AS y FROM coordinator_shouldhaveshards.test_1503003 test WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 NOTICE: executing the command locally: INSERT INTO coordinator_shouldhaveshards.repart_test_1503004 AS citus_table_alias (x, y) SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_results('{repartitioned_results_xxxxx_from_1503000_to_0}'::text[], 'binary'::citus_copy_format) intermediate_result(x integer, y integer) NOTICE: executing the command locally: INSERT INTO coordinator_shouldhaveshards.repart_test_1503007 AS citus_table_alias (x, y) SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_results('{repartitioned_results_xxxxx_from_1503003_to_3}'::text[], 'binary'::citus_copy_format) intermediate_result(x integer, y integer) SELECT y FROM repart_test WHERE x = 1000; @@ -126,8 +126,8 @@ SELECT y FROM repart_test WHERE x = 1000; (1 row) INSERT INTO repart_test (x, y) SELECT y, x FROM test ON CONFLICT (x) DO UPDATE SET y = -1; -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1503000_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1503000_to','SELECT y AS x, x AS y FROM coordinator_shouldhaveshards.test_1503000 test WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1503003_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1503003_to','SELECT y AS x, x AS y FROM coordinator_shouldhaveshards.test_1503003 test WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1503000_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1503000_to','SELECT y AS x, x AS y FROM coordinator_shouldhaveshards.test_1503000 test WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1503003_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1503003_to','SELECT y AS x, x AS y FROM coordinator_shouldhaveshards.test_1503003 test WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 NOTICE: executing the command locally: INSERT INTO coordinator_shouldhaveshards.repart_test_1503004 AS citus_table_alias (x, y) SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_results('{repartitioned_results_xxxxx_from_1503000_to_0}'::text[], 'binary'::citus_copy_format) intermediate_result(x integer, y integer) ON CONFLICT(x) DO UPDATE SET y = '-1'::integer NOTICE: executing the command locally: INSERT INTO coordinator_shouldhaveshards.repart_test_1503007 AS citus_table_alias (x, y) SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_results('{repartitioned_results_xxxxx_from_1503003_to_3}'::text[], 'binary'::citus_copy_format) intermediate_result(x integer, y integer) ON CONFLICT(x) DO UPDATE SET y = '-1'::integer SELECT y FROM repart_test WHERE x = 1000; @@ -255,28 +255,28 @@ SELECT count(*) FROM test t1, test t2 WHERE t1.x = t2.y; BEGIN; SET citus.enable_unique_job_ids TO off; SELECT count(*) FROM test t1, test t2 WHERE t1.x = t2.y; -NOTICE: executing the command locally: SELECT partition_index, 'repartition_26_1' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_26_1','SELECT x AS column1 FROM coordinator_shouldhaveshards.test_1503000 t1 WHERE true',0,'hash','{-2147483648,-1431655766,-715827884,-2,715827880,1431655762}'::text[],'{-1431655767,-715827885,-3,715827879,1431655761,2147483647}'::text[],true,true,true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartition_26_4' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_26_4','SELECT x AS column1 FROM coordinator_shouldhaveshards.test_1503003 t1 WHERE true',0,'hash','{-2147483648,-1431655766,-715827884,-2,715827880,1431655762}'::text[],'{-1431655767,-715827885,-3,715827879,1431655761,2147483647}'::text[],true,true,true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartition_27_1' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_27_1','SELECT y AS column1 FROM coordinator_shouldhaveshards.test_1503000 t2 WHERE true',0,'hash','{-2147483648,-1431655766,-715827884,-2,715827880,1431655762}'::text[],'{-1431655767,-715827885,-3,715827879,1431655761,2147483647}'::text[],true,true,true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartition_27_4' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_27_4','SELECT y AS column1 FROM coordinator_shouldhaveshards.test_1503003 t2 WHERE true',0,'hash','{-2147483648,-1431655766,-715827884,-2,715827880,1431655762}'::text[],'{-1431655767,-715827885,-3,715827879,1431655761,2147483647}'::text[],true,true,true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_26_1_2']::text[],'localhost',57636) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_26_2_2']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_26_3_2']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_26_4_2']::text[],'localhost',57636) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_27_1_2']::text[],'localhost',57636) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_27_2_2']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_27_3_2']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_27_4_2']::text[],'localhost',57636) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_26_1_5']::text[],'localhost',57636) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_26_2_5']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_26_3_5']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_26_4_5']::text[],'localhost',57636) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_27_1_5']::text[],'localhost',57636) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_27_2_5']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_27_3_5']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_27_4_5']::text[],'localhost',57636) bytes -NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_26_1_2,repartition_26_2_2,repartition_26_3_2,repartition_26_4_2}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 integer) JOIN read_intermediate_results('{repartition_27_1_2,repartition_27_2_2,repartition_27_3_2,repartition_27_4_2}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 integer) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true -NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_26_1_5,repartition_26_2_5,repartition_26_3_5,repartition_26_4_5}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 integer) JOIN read_intermediate_results('{repartition_27_1_5,repartition_27_2_5,repartition_27_3_5,repartition_27_4_5}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 integer) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true +NOTICE: executing the command locally: SELECT partition_index, 'repartition_26_1' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_26_1','SELECT x AS column1 FROM coordinator_shouldhaveshards.test_1503000 t1 WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true,true,true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartition_26_4' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_26_4','SELECT x AS column1 FROM coordinator_shouldhaveshards.test_1503003 t1 WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true,true,true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartition_27_1' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_27_1','SELECT y AS column1 FROM coordinator_shouldhaveshards.test_1503000 t2 WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true,true,true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartition_27_4' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_27_4','SELECT y AS column1 FROM coordinator_shouldhaveshards.test_1503003 t2 WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true,true,true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_26_1_N']::text[],'localhost',57636) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_26_2_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_26_3_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_26_4_N']::text[],'localhost',57636) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_27_1_N']::text[],'localhost',57636) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_27_2_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_27_3_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_27_4_N']::text[],'localhost',57636) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_26_1_N']::text[],'localhost',57636) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_26_2_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_26_3_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_26_4_N']::text[],'localhost',57636) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_27_1_N']::text[],'localhost',57636) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_27_2_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_27_3_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_27_4_N']::text[],'localhost',57636) bytes +NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_26_1_N,repartition_26_2_N,repartition_26_3_N,repartition_26_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 integer) JOIN read_intermediate_results('{repartition_27_1_N,repartition_27_2_N,repartition_27_3_N,repartition_27_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 integer) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_26_1_N,repartition_26_2_N,repartition_26_3_N,repartition_26_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 integer) JOIN read_intermediate_results('{repartition_27_1_N,repartition_27_2_N,repartition_27_3_N,repartition_27_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 integer) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true count --------------------------------------------------------------------- 100 @@ -294,28 +294,28 @@ NOTICE: executing the command locally: SELECT y FROM coordinator_shouldhaveshar (1 row) SELECT count(*) FROM test t1, test t2 WHERE t1.x = t2.y; -NOTICE: executing the command locally: SELECT partition_index, 'repartition_30_1' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_30_1','SELECT x AS column1 FROM coordinator_shouldhaveshards.test_1503000 t1 WHERE true',0,'hash','{-2147483648,-1431655766,-715827884,-2,715827880,1431655762}'::text[],'{-1431655767,-715827885,-3,715827879,1431655761,2147483647}'::text[],true,true,true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartition_30_4' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_30_4','SELECT x AS column1 FROM coordinator_shouldhaveshards.test_1503003 t1 WHERE true',0,'hash','{-2147483648,-1431655766,-715827884,-2,715827880,1431655762}'::text[],'{-1431655767,-715827885,-3,715827879,1431655761,2147483647}'::text[],true,true,true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartition_31_1' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_31_1','SELECT y AS column1 FROM coordinator_shouldhaveshards.test_1503000 t2 WHERE true',0,'hash','{-2147483648,-1431655766,-715827884,-2,715827880,1431655762}'::text[],'{-1431655767,-715827885,-3,715827879,1431655761,2147483647}'::text[],true,true,true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartition_31_4' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_31_4','SELECT y AS column1 FROM coordinator_shouldhaveshards.test_1503003 t2 WHERE true',0,'hash','{-2147483648,-1431655766,-715827884,-2,715827880,1431655762}'::text[],'{-1431655767,-715827885,-3,715827879,1431655761,2147483647}'::text[],true,true,true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_30_1_1']::text[],'localhost',57636) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_30_2_1']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_30_3_1']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_30_4_1']::text[],'localhost',57636) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_31_1_1']::text[],'localhost',57636) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_31_2_1']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_31_3_1']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_31_4_1']::text[],'localhost',57636) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_30_1_4']::text[],'localhost',57636) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_30_2_4']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_30_3_4']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_30_4_4']::text[],'localhost',57636) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_31_1_4']::text[],'localhost',57636) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_31_2_4']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_31_3_4']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_31_4_4']::text[],'localhost',57636) bytes -NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_30_1_1,repartition_30_2_1,repartition_30_3_1,repartition_30_4_1}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 integer) JOIN read_intermediate_results('{repartition_31_1_1,repartition_31_2_1,repartition_31_3_1,repartition_31_4_1}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 integer) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true -NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_30_1_4,repartition_30_2_4,repartition_30_3_4,repartition_30_4_4}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 integer) JOIN read_intermediate_results('{repartition_31_1_4,repartition_31_2_4,repartition_31_3_4,repartition_31_4_4}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 integer) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true +NOTICE: executing the command locally: SELECT partition_index, 'repartition_30_1' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_30_1','SELECT x AS column1 FROM coordinator_shouldhaveshards.test_1503000 t1 WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true,true,true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartition_30_4' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_30_4','SELECT x AS column1 FROM coordinator_shouldhaveshards.test_1503003 t1 WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true,true,true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartition_31_1' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_31_1','SELECT y AS column1 FROM coordinator_shouldhaveshards.test_1503000 t2 WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true,true,true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartition_31_4' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_31_4','SELECT y AS column1 FROM coordinator_shouldhaveshards.test_1503003 t2 WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true,true,true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_30_1_N']::text[],'localhost',57636) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_30_2_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_30_3_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_30_4_N']::text[],'localhost',57636) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_31_1_N']::text[],'localhost',57636) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_31_2_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_31_3_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_31_4_N']::text[],'localhost',57636) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_30_1_N']::text[],'localhost',57636) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_30_2_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_30_3_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_30_4_N']::text[],'localhost',57636) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_31_1_N']::text[],'localhost',57636) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_31_2_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_31_3_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_31_4_N']::text[],'localhost',57636) bytes +NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_30_1_N,repartition_30_2_N,repartition_30_3_N,repartition_30_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 integer) JOIN read_intermediate_results('{repartition_31_1_N,repartition_31_2_N,repartition_31_3_N,repartition_31_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 integer) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_30_1_N,repartition_30_2_N,repartition_30_3_N,repartition_30_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 integer) JOIN read_intermediate_results('{repartition_31_1_N,repartition_31_2_N,repartition_31_3_N,repartition_31_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 integer) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true count --------------------------------------------------------------------- 100 @@ -559,10 +559,10 @@ BEGIN; -- this will use perPlacementQueryStrings, make sure it works correctly with -- copying task INSERT INTO dist_table SELECT a + 1 FROM dist_table; -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1503027_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1503027_to','SELECT (a OPERATOR(pg_catalog.+) 1) AS a FROM coordinator_shouldhaveshards.dist_table_1503027 dist_table WHERE true',0,'hash','{-2147483648,-1431655766,-715827884,-2,715827880,1431655762}'::text[],'{-1431655767,-715827885,-3,715827879,1431655761,2147483647}'::text[],true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1503029_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1503029_to','SELECT (a OPERATOR(pg_catalog.+) 1) AS a FROM coordinator_shouldhaveshards.dist_table_1503029 dist_table WHERE true',0,'hash','{-2147483648,-1431655766,-715827884,-2,715827880,1431655762}'::text[],'{-1431655767,-715827885,-3,715827879,1431655761,2147483647}'::text[],true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1503030_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1503030_to','SELECT (a OPERATOR(pg_catalog.+) 1) AS a FROM coordinator_shouldhaveshards.dist_table_1503030 dist_table WHERE true',0,'hash','{-2147483648,-1431655766,-715827884,-2,715827880,1431655762}'::text[],'{-1431655767,-715827885,-3,715827879,1431655761,2147483647}'::text[],true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1503032_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1503032_to','SELECT (a OPERATOR(pg_catalog.+) 1) AS a FROM coordinator_shouldhaveshards.dist_table_1503032 dist_table WHERE true',0,'hash','{-2147483648,-1431655766,-715827884,-2,715827880,1431655762}'::text[],'{-1431655767,-715827885,-3,715827879,1431655761,2147483647}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1503027_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1503027_to','SELECT (a OPERATOR(pg_catalog.+) 1) AS a FROM coordinator_shouldhaveshards.dist_table_1503027 dist_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1503029_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1503029_to','SELECT (a OPERATOR(pg_catalog.+) 1) AS a FROM coordinator_shouldhaveshards.dist_table_1503029 dist_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1503030_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1503030_to','SELECT (a OPERATOR(pg_catalog.+) 1) AS a FROM coordinator_shouldhaveshards.dist_table_1503030 dist_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1503032_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1503032_to','SELECT (a OPERATOR(pg_catalog.+) 1) AS a FROM coordinator_shouldhaveshards.dist_table_1503032 dist_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 ROLLBACK; SET citus.shard_replication_factor TO 1; BEGIN; diff --git a/src/test/regress/expected/drop_column_partitioned_table.out b/src/test/regress/expected/drop_column_partitioned_table.out index 824b34ff0d2..c39b2047ddd 100644 --- a/src/test/regress/expected/drop_column_partitioned_table.out +++ b/src/test/regress/expected/drop_column_partitioned_table.out @@ -167,7 +167,7 @@ VACUUM ANALYZE sensors, sensors_2000, sensors_2001, sensors_2002, sensors_2003; EXPLAIN (COSTS FALSE) INSERT INTO sensors VALUES (3, '2000-02-02', row_to_json(row(1))); QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) + Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task @@ -179,7 +179,7 @@ EXPLAIN (COSTS FALSE) INSERT INTO sensors VALUES (3, '2000-02-02', row_to_json(r EXPLAIN (COSTS FALSE) INSERT INTO sensors_2000 VALUES (3, '2000-01-01', row_to_json(row(1))); QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) + Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task @@ -191,7 +191,7 @@ EXPLAIN (COSTS FALSE) INSERT INTO sensors_2000 VALUES (3, '2000-01-01', row_to_j EXPLAIN (COSTS FALSE) INSERT INTO sensors_2001 VALUES (3, '2001-01-01', row_to_json(row(1))); QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) + Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task @@ -203,7 +203,7 @@ EXPLAIN (COSTS FALSE) INSERT INTO sensors_2001 VALUES (3, '2001-01-01', row_to_j EXPLAIN (COSTS FALSE) INSERT INTO sensors_2002 VALUES (3, '2002-01-01', row_to_json(row(1))); QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) + Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task @@ -215,7 +215,7 @@ EXPLAIN (COSTS FALSE) INSERT INTO sensors_2002 VALUES (3, '2002-01-01', row_to_j EXPLAIN (COSTS FALSE) INSERT INTO sensors_2003 VALUES (3, '2003-01-01', row_to_json(row(1))); QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) + Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task diff --git a/src/test/regress/expected/failure_connection_establishment.out b/src/test/regress/expected/failure_connection_establishment.out index 2cab5c6957c..b26ed94faa8 100644 --- a/src/test/regress/expected/failure_connection_establishment.out +++ b/src/test/regress/expected/failure_connection_establishment.out @@ -204,6 +204,7 @@ SELECT citus.mitmproxy('conn.allow()'); (1 row) SET citus.shard_replication_factor TO 1; +SET citus.enable_single_task_execution TO false; -- use adaptive executor for predictable error messages CREATE TABLE single_replicatated(key int); SELECT create_distributed_table('single_replicatated', 'key'); create_distributed_table diff --git a/src/test/regress/expected/failure_multi_dml.out b/src/test/regress/expected/failure_multi_dml.out index 7757f574c93..150594f1eaf 100644 --- a/src/test/regress/expected/failure_multi_dml.out +++ b/src/test/regress/expected/failure_multi_dml.out @@ -6,6 +6,7 @@ SELECT citus.mitmproxy('conn.allow()'); SET citus.shard_count = 2; SET citus.shard_replication_factor = 1; -- one shard per worker +SET citus.enable_single_task_execution TO false; -- use adaptive executor for predictable error messages SET citus.next_shard_id TO 103400; ALTER SEQUENCE pg_catalog.pg_dist_placement_placementid_seq RESTART 100; CREATE TABLE dml_test (id integer, name text); @@ -202,6 +203,7 @@ SELECT master_run_on_worker( ARRAY['localhost']::text[], ARRAY[:master_port]::int[], ARRAY[' +SET citus.enable_single_task_execution TO false; BEGIN; DELETE FROM dml_test WHERE id = 1; DELETE FROM dml_test WHERE id = 2; @@ -217,7 +219,7 @@ CONTEXT: while executing command on localhost:xxxxx while executing command on localhost:xxxxx master_run_on_worker --------------------------------------------------------------------- - (localhost,57636,t,BEGIN) + (localhost,57636,t,SET) (1 row) SELECT citus.mitmproxy('conn.allow()'); diff --git a/src/test/regress/expected/failure_savepoints.out b/src/test/regress/expected/failure_savepoints.out index ca5cb91f62a..893e155e554 100644 --- a/src/test/regress/expected/failure_savepoints.out +++ b/src/test/regress/expected/failure_savepoints.out @@ -9,6 +9,7 @@ SELECT citus.mitmproxy('conn.allow()'); SET citus.shard_count = 2; SET citus.shard_replication_factor = 1; -- one shard per worker +SET citus.enable_single_task_execution TO false; -- use adaptive executor for predictable error messages SET citus.next_shard_id TO 100950; SET client_min_messages TO ERROR; ALTER SEQUENCE pg_catalog.pg_dist_placement_placementid_seq RESTART 150; diff --git a/src/test/regress/expected/failure_single_select.out b/src/test/regress/expected/failure_single_select.out index 586dd47569f..4fb2f7ae7b1 100644 --- a/src/test/regress/expected/failure_single_select.out +++ b/src/test/regress/expected/failure_single_select.out @@ -164,6 +164,7 @@ SET citus.max_cached_conns_per_worker TO 0; -- purge cache DROP TABLE select_test; SET citus.shard_count = 2; SET citus.shard_replication_factor = 1; +SET citus.enable_single_task_execution TO false; -- use adaptive executor for predictable error messages CREATE TABLE select_test (key int, value text); SELECT create_distributed_table('select_test', 'key'); create_distributed_table diff --git a/src/test/regress/expected/local_shard_execution.out b/src/test/regress/expected/local_shard_execution.out index f50db7245a6..f6c370e3084 100644 --- a/src/test/regress/expected/local_shard_execution.out +++ b/src/test/regress/expected/local_shard_execution.out @@ -14,7 +14,7 @@ SELECT create_reference_table('reference_table'); (1 row) CREATE TABLE distributed_table (key int PRIMARY KEY , value text, age bigint CHECK (age > 10), FOREIGN KEY (key) REFERENCES reference_table(key) ON DELETE CASCADE); -SELECT create_distributed_table('distributed_table','key'); +SELECT create_distributed_table('distributed_table','key', colocate_with => 'none'); create_distributed_table --------------------------------------------------------------------- @@ -40,7 +40,7 @@ CREATE TABLE collections_list ( value numeric, PRIMARY KEY(key, collection_id) ) PARTITION BY LIST (collection_id ); -SELECT create_distributed_table('collections_list', 'key'); +SELECT create_distributed_table('collections_list', 'key', colocate_with => 'none'); create_distributed_table --------------------------------------------------------------------- @@ -83,7 +83,7 @@ SELECT create_distributed_table('stats', 'account_id', colocate_with => 'account INSERT INTO accounts (id) VALUES ('foo'); INSERT INTO stats (account_id, spent) VALUES ('foo', 100); CREATE TABLE abcd(a int, b int, c int, d int); -SELECT create_distributed_table('abcd', 'b'); +SELECT create_distributed_table('abcd', 'b', colocate_with => 'none'); create_distributed_table --------------------------------------------------------------------- @@ -208,7 +208,7 @@ SET citus.log_local_commands TO ON; -- first, make sure that local execution works fine -- with simple queries that are not in transcation blocks SELECT count(*) FROM distributed_table WHERE key = 1; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) count --------------------------------------------------------------------- 1 @@ -238,12 +238,12 @@ SELECT count(*) FROM distributed_table; -- modifications also follow the same rules INSERT INTO reference_table VALUES (1) ON CONFLICT DO NOTHING; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_1470000 AS citus_table_alias (key) VALUES (1) ON CONFLICT DO NOTHING +NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_xxxxxxx AS citus_table_alias (key) VALUES (1) ON CONFLICT DO NOTHING INSERT INTO distributed_table VALUES (1, '1', 21) ON CONFLICT DO NOTHING; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '1'::text, 21) ON CONFLICT DO NOTHING +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '1'::text, 21) ON CONFLICT DO NOTHING -- local query DELETE FROM distributed_table WHERE key = 1 AND age = 21; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE ((key OPERATOR(pg_catalog.=) 1) AND (age OPERATOR(pg_catalog.=) 21)) +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE ((key OPERATOR(pg_catalog.=) 1) AND (age OPERATOR(pg_catalog.=) 21)) -- hitting multiple shards, so should be a distributed execution DELETE FROM distributed_table WHERE age = 21; -- although both shards are local, the executor choose the parallel execution @@ -253,7 +253,7 @@ DELETE FROM second_distributed_table WHERE key IN (1,6); DELETE FROM second_distributed_table; -- load some more data for the following tests INSERT INTO second_distributed_table VALUES (1, '1'); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.second_distributed_table_1470005 (key, value) VALUES (1, '1'::text) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.second_distributed_table_xxxxxxx (key, value) VALUES (1, '1'::text) -- INSERT .. SELECT hitting a single single (co-located) shard(s) should -- be executed locally INSERT INTO distributed_table @@ -265,7 +265,7 @@ WHERE distributed_table.key = 1 and distributed_table.key=second_distributed_table.key ON CONFLICT(key) DO UPDATE SET value = '22' RETURNING *; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) SELECT distributed_table.key, distributed_table.value, distributed_table.age FROM local_shard_execution.distributed_table_1470001 distributed_table, local_shard_execution.second_distributed_table_1470005 second_distributed_table WHERE (((distributed_table.key OPERATOR(pg_catalog.=) 1) AND (distributed_table.key OPERATOR(pg_catalog.=) second_distributed_table.key)) AND (distributed_table.key IS NOT NULL)) ON CONFLICT(key) DO UPDATE SET value = '22'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) SELECT distributed_table.key, distributed_table.value, distributed_table.age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table, local_shard_execution.second_distributed_table_xxxxxxx second_distributed_table WHERE (((distributed_table.key OPERATOR(pg_catalog.=) 1) AND (distributed_table.key OPERATOR(pg_catalog.=) second_distributed_table.key)) AND (distributed_table.key IS NOT NULL)) ON CONFLICT(key) DO UPDATE SET value = '22'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age key | value | age --------------------------------------------------------------------- 1 | 22 | 20 @@ -289,9 +289,9 @@ RETURNING *; -- that's why it is disallowed to use local execution even if the SELECT -- can be executed locally INSERT INTO distributed_table SELECT sum(key), value FROM distributed_table WHERE key = 1 GROUP BY value ON CONFLICT DO NOTHING; -NOTICE: executing the command locally: SELECT int4(sum(key)) AS key, value FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) GROUP BY value +NOTICE: executing the command locally: SELECT int4(sum(key)) AS key, value FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) GROUP BY value NOTICE: executing the copy locally for colocated file with shard xxxxx -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value) SELECT intermediate_result.key, intermediate_result.value FROM read_intermediate_result('insert_select_XXX_1470001'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text) ON CONFLICT DO NOTHING +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value) SELECT intermediate_result.key, intermediate_result.value FROM read_intermediate_result('insert_select_XXX_xxxxxxx'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text) ON CONFLICT DO NOTHING INSERT INTO distributed_table SELECT 1, '1',15 FROM distributed_table WHERE key = 2 LIMIT 1 ON CONFLICT DO NOTHING; -- sanity check: multi-shard INSERT..SELECT pushdown goes through distributed execution INSERT INTO distributed_table SELECT * FROM distributed_table ON CONFLICT DO NOTHING; @@ -302,12 +302,12 @@ SET citus.enable_binary_protocol = TRUE; EXPLAIN (COSTS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20; QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) + Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task Node: host=localhost port=xxxxx dbname=regression - -> Index Scan using distributed_table_pkey_1470001 on distributed_table_1470001 distributed_table + -> Index Scan using distributed_table_pkey_xxxxxxx on distributed_table_xxxxxxx distributed_table Index Cond: (key = 1) Filter: (age = 20) (8 rows) @@ -316,14 +316,14 @@ EXPLAIN (COSTS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20; select public.explain_filter('EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) SELECT * FROM distributed_table WHERE key = 1 AND age = 20'); explain_filter --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) (actual rows=N loops=N) + Custom Scan (Citus Single Task) (actual rows=N loops=N) Task Count: N Tuple data received from nodes: N bytes Tasks Shown: All -> Task Tuple data received from node: N bytes Node: host=localhost port=N dbname=regression - -> Index Scan using distributed_table_pkey_1470001 on distributed_table_1470001 distributed_table (actual rows=N loops=N) + -> Index Scan using distributed_table_pkey_xxxxxxx on distributed_table_xxxxxxx distributed_table (actual rows=N loops=N) Index Cond: (key = N) Filter: (age = N) @@ -344,7 +344,7 @@ SELECT 1 FROM r WHERE z < 3; -> Task Tuple data received from node: 22 bytes Node: host=localhost port=xxxxx dbname=regression - -> Seq Scan on distributed_table_1470001 distributed_table (actual rows=1 loops=1) + -> Seq Scan on distributed_table_xxxxxxx distributed_table (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -358,13 +358,13 @@ SELECT 1 FROM r WHERE z < 3; EXPLAIN (COSTS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20; QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) + Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task Node: host=localhost port=xxxxx dbname=regression - -> Delete on distributed_table_1470001 distributed_table - -> Index Scan using distributed_table_pkey_1470001 on distributed_table_1470001 distributed_table + -> Delete on distributed_table_xxxxxxx distributed_table + -> Index Scan using distributed_table_pkey_xxxxxxx on distributed_table_xxxxxxx distributed_table Index Cond: (key = 1) Filter: (age = 20) (9 rows) @@ -373,36 +373,36 @@ EXPLAIN (COSTS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20; select public.explain_filter('EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) DELETE FROM distributed_table WHERE key = 1 AND age = 20'); explain_filter --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) (actual rows=N loops=N) + Custom Scan (Citus Single Task) (actual rows=N loops=N) Task Count: N Tasks Shown: All -> Task Node: host=localhost port=N dbname=regression - -> Delete on distributed_table_1470001 distributed_table (actual rows=N loops=N) - -> Index Scan using distributed_table_pkey_1470001 on distributed_table_1470001 distributed_table (actual rows=N loops=N) + -> Delete on distributed_table_xxxxxxx distributed_table (actual rows=N loops=N) + -> Index Scan using distributed_table_pkey_xxxxxxx on distributed_table_xxxxxxx distributed_table (actual rows=N loops=N) Index Cond: (key = N) Filter: (age = N) - Trigger for constraint second_distributed_table_key_fkey_1470005: calls=N + Trigger for constraint second_distributed_table_key_fkey_xxxxxxx: calls=N \pset footer on -- show that EXPLAIN ANALYZE deleted the row and cascades deletes SELECT * FROM distributed_table WHERE key = 1 AND age = 20 ORDER BY 1,2,3; -NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE ((key OPERATOR(pg_catalog.=) 1) AND (age OPERATOR(pg_catalog.=) 20)) ORDER BY key, value, age +NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE ((key OPERATOR(pg_catalog.=) 1) AND (age OPERATOR(pg_catalog.=) 20)) ORDER BY key, value, age key | value | age --------------------------------------------------------------------- (0 rows) SELECT * FROM second_distributed_table WHERE key = 1 ORDER BY 1,2; -NOTICE: executing the command locally: SELECT key, value FROM local_shard_execution.second_distributed_table_1470005 second_distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) ORDER BY key, value +NOTICE: executing the command locally: SELECT key, value FROM local_shard_execution.second_distributed_table_xxxxxxx second_distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) ORDER BY key, value key | value --------------------------------------------------------------------- (0 rows) -- Put rows back for other tests INSERT INTO distributed_table VALUES (1, '22', 20); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 (key, value, age) VALUES (1, '22'::text, 20) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx (key, value, age) VALUES (1, '22'::text, 20) INSERT INTO second_distributed_table VALUES (1, '1'); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.second_distributed_table_1470005 (key, value) VALUES (1, '1'::text) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.second_distributed_table_xxxxxxx (key, value) VALUES (1, '1'::text) SET citus.enable_ddl_propagation TO OFF; CREATE VIEW abcd_view AS SELECT * FROM abcd; RESET citus.enable_ddl_propagation; @@ -416,8 +416,8 @@ SELECT * FROM abcd first join abcd second on first.b = second.b ORDER BY 1,2,3,4 BEGIN; SELECT * FROM abcd first join abcd second on first.b = second.b ORDER BY 1,2,3,4; -NOTICE: executing the command locally: SELECT first.b, first.c, first.d, second.b, second.c, second.d FROM (local_shard_execution.abcd_1470025 first JOIN local_shard_execution.abcd_1470025 second ON ((first.b OPERATOR(pg_catalog.=) second.b))) WHERE true ORDER BY first.b, first.c, first.d, second.b -NOTICE: executing the command locally: SELECT first.b, first.c, first.d, second.b, second.c, second.d FROM (local_shard_execution.abcd_1470027 first JOIN local_shard_execution.abcd_1470027 second ON ((first.b OPERATOR(pg_catalog.=) second.b))) WHERE true ORDER BY first.b, first.c, first.d, second.b +NOTICE: executing the command locally: SELECT first.b, first.c, first.d, second.b, second.c, second.d FROM (local_shard_execution.abcd_xxxxxxx first JOIN local_shard_execution.abcd_xxxxxxx second ON ((first.b OPERATOR(pg_catalog.=) second.b))) WHERE true ORDER BY first.b, first.c, first.d, second.b +NOTICE: executing the command locally: SELECT first.b, first.c, first.d, second.b, second.c, second.d FROM (local_shard_execution.abcd_xxxxxxx first JOIN local_shard_execution.abcd_xxxxxxx second ON ((first.b OPERATOR(pg_catalog.=) second.b))) WHERE true ORDER BY first.b, first.c, first.d, second.b b | c | d | b | c | d --------------------------------------------------------------------- 2 | 3 | 4 | 2 | 3 | 4 @@ -428,8 +428,8 @@ NOTICE: executing the command locally: SELECT first.b, first.c, first.d, second END; BEGIN; SELECT * FROM abcd_view first join abcd_view second on first.b = second.b ORDER BY 1,2,3,4; -NOTICE: executing the command locally: SELECT abcd.b, abcd.c, abcd.d, abcd_1.b, abcd_1.c, abcd_1.d FROM (local_shard_execution.abcd_1470025 abcd JOIN local_shard_execution.abcd_1470025 abcd_1 ON ((abcd.b OPERATOR(pg_catalog.=) abcd_1.b))) WHERE true ORDER BY abcd.b, abcd.c, abcd.d, abcd_1.b -NOTICE: executing the command locally: SELECT abcd.b, abcd.c, abcd.d, abcd_1.b, abcd_1.c, abcd_1.d FROM (local_shard_execution.abcd_1470027 abcd JOIN local_shard_execution.abcd_1470027 abcd_1 ON ((abcd.b OPERATOR(pg_catalog.=) abcd_1.b))) WHERE true ORDER BY abcd.b, abcd.c, abcd.d, abcd_1.b +NOTICE: executing the command locally: SELECT abcd.b, abcd.c, abcd.d, abcd_1.b, abcd_1.c, abcd_1.d FROM (local_shard_execution.abcd_xxxxxxx abcd JOIN local_shard_execution.abcd_xxxxxxx abcd_1 ON ((abcd.b OPERATOR(pg_catalog.=) abcd_1.b))) WHERE true ORDER BY abcd.b, abcd.c, abcd.d, abcd_1.b +NOTICE: executing the command locally: SELECT abcd.b, abcd.c, abcd.d, abcd_1.b, abcd_1.c, abcd_1.d FROM (local_shard_execution.abcd_xxxxxxx abcd JOIN local_shard_execution.abcd_xxxxxxx abcd_1 ON ((abcd.b OPERATOR(pg_catalog.=) abcd_1.b))) WHERE true ORDER BY abcd.b, abcd.c, abcd.d, abcd_1.b b | c | d | b | c | d --------------------------------------------------------------------- 2 | 3 | 4 | 2 | 3 | 4 @@ -440,8 +440,8 @@ NOTICE: executing the command locally: SELECT abcd.b, abcd.c, abcd.d, abcd_1.b, END; BEGIN; SELECT * FROM abcd first full join abcd second on first.b = second.b ORDER BY 1,2,3,4; -NOTICE: executing the command locally: SELECT worker_column_1 AS b, worker_column_2 AS c, worker_column_3 AS d, worker_column_4 AS b, worker_column_5 AS c, worker_column_6 AS d FROM (SELECT first.b AS worker_column_1, first.c AS worker_column_2, first.d AS worker_column_3, second.b AS worker_column_4, second.c AS worker_column_5, second.d AS worker_column_6 FROM (local_shard_execution.abcd_1470025 first FULL JOIN local_shard_execution.abcd_1470025 second ON ((first.b OPERATOR(pg_catalog.=) second.b)))) worker_subquery ORDER BY worker_column_1, worker_column_2, worker_column_3, worker_column_4 -NOTICE: executing the command locally: SELECT worker_column_1 AS b, worker_column_2 AS c, worker_column_3 AS d, worker_column_4 AS b, worker_column_5 AS c, worker_column_6 AS d FROM (SELECT first.b AS worker_column_1, first.c AS worker_column_2, first.d AS worker_column_3, second.b AS worker_column_4, second.c AS worker_column_5, second.d AS worker_column_6 FROM (local_shard_execution.abcd_1470027 first FULL JOIN local_shard_execution.abcd_1470027 second ON ((first.b OPERATOR(pg_catalog.=) second.b)))) worker_subquery ORDER BY worker_column_1, worker_column_2, worker_column_3, worker_column_4 +NOTICE: executing the command locally: SELECT worker_column_1 AS b, worker_column_2 AS c, worker_column_3 AS d, worker_column_4 AS b, worker_column_5 AS c, worker_column_6 AS d FROM (SELECT first.b AS worker_column_1, first.c AS worker_column_2, first.d AS worker_column_3, second.b AS worker_column_4, second.c AS worker_column_5, second.d AS worker_column_6 FROM (local_shard_execution.abcd_xxxxxxx first FULL JOIN local_shard_execution.abcd_xxxxxxx second ON ((first.b OPERATOR(pg_catalog.=) second.b)))) worker_subquery ORDER BY worker_column_1, worker_column_2, worker_column_3, worker_column_4 +NOTICE: executing the command locally: SELECT worker_column_1 AS b, worker_column_2 AS c, worker_column_3 AS d, worker_column_4 AS b, worker_column_5 AS c, worker_column_6 AS d FROM (SELECT first.b AS worker_column_1, first.c AS worker_column_2, first.d AS worker_column_3, second.b AS worker_column_4, second.c AS worker_column_5, second.d AS worker_column_6 FROM (local_shard_execution.abcd_xxxxxxx first FULL JOIN local_shard_execution.abcd_xxxxxxx second ON ((first.b OPERATOR(pg_catalog.=) second.b)))) worker_subquery ORDER BY worker_column_1, worker_column_2, worker_column_3, worker_column_4 b | c | d | b | c | d --------------------------------------------------------------------- 2 | 3 | 4 | 2 | 3 | 4 @@ -452,8 +452,8 @@ NOTICE: executing the command locally: SELECT worker_column_1 AS b, worker_colu END; BEGIN; SELECT * FROM abcd first join abcd second USING(b) ORDER BY 1,2,3,4; -NOTICE: executing the command locally: SELECT first.b, first.c, first.d, second.c, second.d FROM (local_shard_execution.abcd_1470025 first JOIN local_shard_execution.abcd_1470025 second ON ((first.b OPERATOR(pg_catalog.=) second.b))) WHERE true ORDER BY first.b, first.c, first.d, second.c -NOTICE: executing the command locally: SELECT first.b, first.c, first.d, second.c, second.d FROM (local_shard_execution.abcd_1470027 first JOIN local_shard_execution.abcd_1470027 second ON ((first.b OPERATOR(pg_catalog.=) second.b))) WHERE true ORDER BY first.b, first.c, first.d, second.c +NOTICE: executing the command locally: SELECT first.b, first.c, first.d, second.c, second.d FROM (local_shard_execution.abcd_xxxxxxx first JOIN local_shard_execution.abcd_xxxxxxx second ON ((first.b OPERATOR(pg_catalog.=) second.b))) WHERE true ORDER BY first.b, first.c, first.d, second.c +NOTICE: executing the command locally: SELECT first.b, first.c, first.d, second.c, second.d FROM (local_shard_execution.abcd_xxxxxxx first JOIN local_shard_execution.abcd_xxxxxxx second ON ((first.b OPERATOR(pg_catalog.=) second.b))) WHERE true ORDER BY first.b, first.c, first.d, second.c b | c | d | c | d --------------------------------------------------------------------- 2 | 3 | 4 | 3 | 4 @@ -464,8 +464,8 @@ NOTICE: executing the command locally: SELECT first.b, first.c, first.d, second END; BEGIN; SELECT * FROM abcd first join abcd second USING(b) join abcd third on first.b=third.b ORDER BY 1,2,3,4; -NOTICE: executing the command locally: SELECT first.b, first.c, first.d, second.c, second.d, third.b, third.c, third.d FROM ((local_shard_execution.abcd_1470025 first JOIN local_shard_execution.abcd_1470025 second ON ((first.b OPERATOR(pg_catalog.=) second.b))) JOIN local_shard_execution.abcd_1470025 third ON ((first.b OPERATOR(pg_catalog.=) third.b))) WHERE true ORDER BY first.b, first.c, first.d, second.c -NOTICE: executing the command locally: SELECT first.b, first.c, first.d, second.c, second.d, third.b, third.c, third.d FROM ((local_shard_execution.abcd_1470027 first JOIN local_shard_execution.abcd_1470027 second ON ((first.b OPERATOR(pg_catalog.=) second.b))) JOIN local_shard_execution.abcd_1470027 third ON ((first.b OPERATOR(pg_catalog.=) third.b))) WHERE true ORDER BY first.b, first.c, first.d, second.c +NOTICE: executing the command locally: SELECT first.b, first.c, first.d, second.c, second.d, third.b, third.c, third.d FROM ((local_shard_execution.abcd_xxxxxxx first JOIN local_shard_execution.abcd_xxxxxxx second ON ((first.b OPERATOR(pg_catalog.=) second.b))) JOIN local_shard_execution.abcd_xxxxxxx third ON ((first.b OPERATOR(pg_catalog.=) third.b))) WHERE true ORDER BY first.b, first.c, first.d, second.c +NOTICE: executing the command locally: SELECT first.b, first.c, first.d, second.c, second.d, third.b, third.c, third.d FROM ((local_shard_execution.abcd_xxxxxxx first JOIN local_shard_execution.abcd_xxxxxxx second ON ((first.b OPERATOR(pg_catalog.=) second.b))) JOIN local_shard_execution.abcd_xxxxxxx third ON ((first.b OPERATOR(pg_catalog.=) third.b))) WHERE true ORDER BY first.b, first.c, first.d, second.c b | c | d | c | d | b | c | d --------------------------------------------------------------------- 2 | 3 | 4 | 3 | 4 | 2 | 3 | 4 @@ -487,14 +487,14 @@ COPY second_distributed_table FROM STDIN WITH CSV; -- rollback should be able to rollback local execution BEGIN; INSERT INTO distributed_table VALUES (1, '11',21) ON CONFLICT(key) DO UPDATE SET value = '29' RETURNING *; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '29'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '29'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age key | value | age --------------------------------------------------------------------- 1 | 29 | 20 (1 row) SELECT * FROM distributed_table WHERE key = 1 ORDER BY 1,2,3; -NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) ORDER BY key, value, age +NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) ORDER BY key, value, age key | value | age --------------------------------------------------------------------- 1 | 29 | 20 @@ -503,7 +503,7 @@ NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_ ROLLBACK; -- make sure that the value is rollbacked SELECT * FROM distributed_table WHERE key = 1 ORDER BY 1,2,3; -NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) ORDER BY key, value, age +NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) ORDER BY key, value, age key | value | age --------------------------------------------------------------------- 1 | 22 | 20 @@ -512,19 +512,19 @@ NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_ -- rollback should be able to rollback both the local and distributed executions BEGIN; INSERT INTO distributed_table VALUES (1, '11',21) ON CONFLICT(key) DO UPDATE SET value = '29' RETURNING *; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '29'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '29'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age key | value | age --------------------------------------------------------------------- 1 | 29 | 20 (1 row) DELETE FROM distributed_table; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470001 distributed_table -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table -- DELETE should cascade, and we should not see any rows SELECT count(*) FROM second_distributed_table; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.second_distributed_table_1470005 second_distributed_table WHERE true -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.second_distributed_table_1470007 second_distributed_table WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.second_distributed_table_xxxxxxx second_distributed_table WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.second_distributed_table_xxxxxxx second_distributed_table WHERE true count --------------------------------------------------------------------- 0 @@ -533,7 +533,7 @@ NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shar ROLLBACK; -- make sure that everything is rollbacked SELECT * FROM distributed_table WHERE key = 1 ORDER BY 1,2,3; -NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) ORDER BY key, value, age +NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) ORDER BY key, value, age key | value | age --------------------------------------------------------------------- 1 | 22 | 20 @@ -557,7 +557,7 @@ SELECT * FROM second_distributed_table ORDER BY 1; BEGIN; -- INSERT is executed locally INSERT INTO distributed_table VALUES (1, '11',21) ON CONFLICT(key) DO UPDATE SET value = '23' RETURNING *; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '23'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '23'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age key | value | age --------------------------------------------------------------------- 1 | 23 | 20 @@ -566,7 +566,7 @@ NOTICE: executing the command locally: INSERT INTO local_shard_execution.distri -- since the INSERT is executed locally, the SELECT should also be -- executed locally and see the changes SELECT * FROM distributed_table WHERE key = 1 ORDER BY 1,2,3; -NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) ORDER BY key, value, age +NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) ORDER BY key, value, age key | value | age --------------------------------------------------------------------- 1 | 23 | 20 @@ -575,8 +575,8 @@ NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_ -- multi-shard SELECTs are now forced to use local execution on -- the shards that reside on this node SELECT * FROM distributed_table WHERE value = '23' ORDER BY 1,2,3; -NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (value OPERATOR(pg_catalog.=) '23'::text) ORDER BY key, value, age -NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (value OPERATOR(pg_catalog.=) '23'::text) ORDER BY key, value, age +NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (value OPERATOR(pg_catalog.=) '23'::text) ORDER BY key, value, age +NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (value OPERATOR(pg_catalog.=) '23'::text) ORDER BY key, value, age key | value | age --------------------------------------------------------------------- 1 | 23 | 20 @@ -585,12 +585,12 @@ NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_ -- similarly, multi-shard modifications should use local exection -- on the shards that reside on this node DELETE FROM distributed_table WHERE value = '23'; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (value OPERATOR(pg_catalog.=) '23'::text) -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (value OPERATOR(pg_catalog.=) '23'::text) +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (value OPERATOR(pg_catalog.=) '23'::text) +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (value OPERATOR(pg_catalog.=) '23'::text) -- make sure that the value is deleted SELECT * FROM distributed_table WHERE value = '23' ORDER BY 1,2,3; -NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (value OPERATOR(pg_catalog.=) '23'::text) ORDER BY key, value, age -NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (value OPERATOR(pg_catalog.=) '23'::text) ORDER BY key, value, age +NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (value OPERATOR(pg_catalog.=) '23'::text) ORDER BY key, value, age +NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (value OPERATOR(pg_catalog.=) '23'::text) ORDER BY key, value, age key | value | age --------------------------------------------------------------------- (0 rows) @@ -598,7 +598,7 @@ NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_ COMMIT; -- make sure that we've committed everything SELECT * FROM distributed_table WHERE key = 1 ORDER BY 1,2,3; -NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) ORDER BY key, value, age +NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) ORDER BY key, value, age key | value | age --------------------------------------------------------------------- (0 rows) @@ -607,12 +607,12 @@ NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_ -- using that and never switch back to local execution BEGIN; DELETE FROM distributed_table WHERE value = '11'; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (value OPERATOR(pg_catalog.=) '11'::text) -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (value OPERATOR(pg_catalog.=) '11'::text) +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (value OPERATOR(pg_catalog.=) '11'::text) +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (value OPERATOR(pg_catalog.=) '11'::text) -- although this command could have been executed -- locally, it is not going to be executed locally SELECT * FROM distributed_table WHERE key = 1 ORDER BY 1,2,3; -NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) ORDER BY key, value, age +NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) ORDER BY key, value, age key | value | age --------------------------------------------------------------------- (0 rows) @@ -629,8 +629,8 @@ NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.sec NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.second_distributed_table_xxxxx CASCADE -- TRUNCATE cascaded into second_distributed_table SELECT count(*) FROM second_distributed_table; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.second_distributed_table_1470005 second_distributed_table WHERE true -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.second_distributed_table_1470007 second_distributed_table WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.second_distributed_table_xxxxxxx second_distributed_table WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.second_distributed_table_xxxxxxx second_distributed_table WHERE true count --------------------------------------------------------------------- 0 @@ -643,22 +643,22 @@ NOTICE: executing the copy locally for shard xxxxx -- show that cascading foreign keys just works fine with local execution BEGIN; INSERT INTO reference_table VALUES (701); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_1470000 (key) VALUES (701) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_xxxxxxx (key) VALUES (701) INSERT INTO distributed_table VALUES (701, '701', 701); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 (key, value, age) VALUES (701, '701'::text, 701) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx (key, value, age) VALUES (701, '701'::text, 701) INSERT INTO second_distributed_table VALUES (701, '701'); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.second_distributed_table_1470005 (key, value) VALUES (701, '701'::text) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.second_distributed_table_xxxxxxx (key, value) VALUES (701, '701'::text) DELETE FROM reference_table WHERE key = 701; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.reference_table_1470000 reference_table WHERE (key OPERATOR(pg_catalog.=) 701) +NOTICE: executing the command locally: DELETE FROM local_shard_execution.reference_table_xxxxxxx reference_table WHERE (key OPERATOR(pg_catalog.=) 701) SELECT count(*) FROM distributed_table WHERE key = 701; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 701) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 701) count --------------------------------------------------------------------- 0 (1 row) SELECT count(*) FROM second_distributed_table WHERE key = 701; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.second_distributed_table_1470005 second_distributed_table WHERE (key OPERATOR(pg_catalog.=) 701) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.second_distributed_table_xxxxxxx second_distributed_table WHERE (key OPERATOR(pg_catalog.=) 701) count --------------------------------------------------------------------- 0 @@ -666,8 +666,8 @@ NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shar -- multi-shard commands should also see the changes SELECT count(*) FROM distributed_table WHERE key > 700; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.>) 700) -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.>) 700) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.>) 700) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.>) 700) count --------------------------------------------------------------------- 0 @@ -675,27 +675,27 @@ NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shar -- we can still do multi-shard commands DELETE FROM distributed_table; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470001 distributed_table -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table ROLLBACK; -- multiple queries hitting different shards can be executed locally BEGIN; SELECT count(*) FROM distributed_table WHERE key = 1; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) count --------------------------------------------------------------------- 0 (1 row) SELECT count(*) FROM distributed_table WHERE key = 6; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.=) 6) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 6) count --------------------------------------------------------------------- 1 (1 row) SELECT count(*) FROM distributed_table WHERE key = 500; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.=) 500) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 500) count --------------------------------------------------------------------- 0 @@ -705,7 +705,7 @@ ROLLBACK; -- a local query followed by TRUNCATE command can be executed locally BEGIN; SELECT count(*) FROM distributed_table WHERE key = 1; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) count --------------------------------------------------------------------- 0 @@ -723,7 +723,7 @@ ROLLBACK; -- a local query is followed by an INSERT..SELECT via the coordinator BEGIN; SELECT count(*) FROM distributed_table WHERE key = 1; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) count --------------------------------------------------------------------- 0 @@ -735,54 +735,54 @@ ROLLBACK; BEGIN; SET citus.enable_repartition_joins TO ON; SELECT count(*) FROM distributed_table; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE true -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true count --------------------------------------------------------------------- 2 (1 row) SELECT count(*) FROM distributed_table d1 join distributed_table d2 using(age); -NOTICE: executing the command locally: SELECT partition_index, 'repartition_70_1' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_70_1','SELECT age AS column1 FROM local_shard_execution.distributed_table_1470001 d1 WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true,true,true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartition_70_3' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_70_3','SELECT age AS column1 FROM local_shard_execution.distributed_table_1470003 d1 WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true,true,true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartition_71_1' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_71_1','SELECT age AS column1 FROM local_shard_execution.distributed_table_1470001 d2 WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true,true,true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartition_71_3' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_71_3','SELECT age AS column1 FROM local_shard_execution.distributed_table_1470003 d2 WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true,true,true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_1_0']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_2_0']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_3_0']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_4_0']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_1_0']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_2_0']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_3_0']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_4_0']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_1_1']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_2_1']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_3_1']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_4_1']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_1_1']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_2_1']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_3_1']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_4_1']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_1_2']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_2_2']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_3_2']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_4_2']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_1_2']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_2_2']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_3_2']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_4_2']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_1_3']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_2_3']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_3_3']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_4_3']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_1_3']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_2_3']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_3_3']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_4_3']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_70_1_0,repartition_70_2_0,repartition_70_3_0,repartition_70_4_0}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 bigint) JOIN read_intermediate_results('{repartition_71_1_0,repartition_71_2_0,repartition_71_3_0,repartition_71_4_0}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 bigint) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true -NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_70_1_1,repartition_70_2_1,repartition_70_3_1,repartition_70_4_1}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 bigint) JOIN read_intermediate_results('{repartition_71_1_1,repartition_71_2_1,repartition_71_3_1,repartition_71_4_1}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 bigint) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true -NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_70_1_2,repartition_70_2_2,repartition_70_3_2,repartition_70_4_2}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 bigint) JOIN read_intermediate_results('{repartition_71_1_2,repartition_71_2_2,repartition_71_3_2,repartition_71_4_2}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 bigint) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true -NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_70_1_3,repartition_70_2_3,repartition_70_3_3,repartition_70_4_3}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 bigint) JOIN read_intermediate_results('{repartition_71_1_3,repartition_71_2_3,repartition_71_3_3,repartition_71_4_3}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 bigint) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true +NOTICE: executing the command locally: SELECT partition_index, 'repartition_70_1' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_70_1','SELECT age AS column1 FROM local_shard_execution.distributed_table_xxxxxxx d1 WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true,true,true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartition_70_3' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_70_3','SELECT age AS column1 FROM local_shard_execution.distributed_table_xxxxxxx d1 WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true,true,true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartition_71_1' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_71_1','SELECT age AS column1 FROM local_shard_execution.distributed_table_xxxxxxx d2 WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true,true,true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartition_71_3' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_71_3','SELECT age AS column1 FROM local_shard_execution.distributed_table_xxxxxxx d2 WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true,true,true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_1_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_2_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_3_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_4_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_1_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_2_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_3_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_4_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_1_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_2_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_3_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_4_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_1_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_2_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_3_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_4_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_1_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_2_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_3_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_4_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_1_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_2_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_3_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_4_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_1_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_2_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_3_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_4_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_1_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_2_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_3_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_71_4_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_70_1_N,repartition_70_2_N,repartition_70_3_N,repartition_70_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 bigint) JOIN read_intermediate_results('{repartition_71_1_N,repartition_71_2_N,repartition_71_3_N,repartition_71_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 bigint) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_70_1_N,repartition_70_2_N,repartition_70_3_N,repartition_70_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 bigint) JOIN read_intermediate_results('{repartition_71_1_N,repartition_71_2_N,repartition_71_3_N,repartition_71_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 bigint) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_70_1_N,repartition_70_2_N,repartition_70_3_N,repartition_70_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 bigint) JOIN read_intermediate_results('{repartition_71_1_N,repartition_71_2_N,repartition_71_3_N,repartition_71_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 bigint) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_70_1_N,repartition_70_2_N,repartition_70_3_N,repartition_70_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 bigint) JOIN read_intermediate_results('{repartition_71_1_N,repartition_71_2_N,repartition_71_3_N,repartition_71_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 bigint) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true count --------------------------------------------------------------------- 2 @@ -792,22 +792,22 @@ ROLLBACK; -- a local query is followed by an INSERT..SELECT with re-partitioning BEGIN; SELECT count(*) FROM distributed_table WHERE key = 6; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.=) 6) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 6) count --------------------------------------------------------------------- 1 (1 row) INSERT INTO reference_table (key) SELECT -key FROM distributed_table; -NOTICE: executing the command locally: SELECT (OPERATOR(pg_catalog.-) key) AS key FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE true -NOTICE: executing the command locally: SELECT (OPERATOR(pg_catalog.-) key) AS key FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE true +NOTICE: executing the command locally: SELECT (OPERATOR(pg_catalog.-) key) AS key FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true +NOTICE: executing the command locally: SELECT (OPERATOR(pg_catalog.-) key) AS key FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true NOTICE: executing the copy locally for shard xxxxx INSERT INTO distributed_table (key) SELECT -key FROM distributed_table; -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1470001_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1470001_to','SELECT (OPERATOR(pg_catalog.-) key) AS key FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1470003_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1470003_to','SELECT (OPERATOR(pg_catalog.-) key) AS key FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true) WHERE rows_written > 0 -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key) SELECT intermediate_result.key FROM read_intermediate_results('{repartitioned_results_xxxxx_from_1470003_to_0}'::text[], 'binary'::citus_copy_format) intermediate_result(key integer) +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_xxxxxxx_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_xxxxxxx_to','SELECT (OPERATOR(pg_catalog.-) key) AS key FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_xxxxxxx_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_xxxxxxx_to','SELECT (OPERATOR(pg_catalog.-) key) AS key FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key) SELECT intermediate_result.key FROM read_intermediate_results('{repartitioned_results_xxxxx_from_xxxxxxx_to_0}'::text[], 'binary'::citus_copy_format) intermediate_result(key integer) SELECT count(*) FROM distributed_table WHERE key = -6; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) '-6'::integer) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) '-6'::integer) count --------------------------------------------------------------------- 1 @@ -815,7 +815,7 @@ NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shar ROLLBACK; INSERT INTO distributed_table VALUES (1, '11',21) ON CONFLICT(key) DO UPDATE SET value = '29' RETURNING *; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '29'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '29'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age key | value | age --------------------------------------------------------------------- 1 | 11 | 21 @@ -823,7 +823,7 @@ NOTICE: executing the command locally: INSERT INTO local_shard_execution.distri BEGIN; DELETE FROM distributed_table WHERE key = 1; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) EXPLAIN ANALYZE DELETE FROM distributed_table WHERE key = 1; ERROR: cannot execute command because a local execution has accessed a placement in the transaction DETAIL: Some parallel commands cannot be executed if a previous command has already been executed locally @@ -865,18 +865,18 @@ CREATE OR REPLACE PROCEDURE only_local_execution() AS $$ END; $$ LANGUAGE plpgsql; CALL only_local_execution(); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '29'::text +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '29'::text CONTEXT: SQL statement "INSERT INTO distributed_table VALUES (1, '11',21) ON CONFLICT(key) DO UPDATE SET value = '29'" PL/pgSQL function only_local_execution() line XX at SQL statement -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) CONTEXT: SQL statement "SELECT count(*) FROM distributed_table WHERE key = 1" PL/pgSQL function only_local_execution() line XX at SQL statement -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) CONTEXT: SQL statement "DELETE FROM distributed_table WHERE key = 1" PL/pgSQL function only_local_execution() line XX at SQL statement -- insert a row that we need in the next tests INSERT INTO distributed_table VALUES (1, '11',21) ON CONFLICT(key) DO UPDATE SET value = '29'; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '29'::text +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '29'::text -- make sure that functions can use local execution CREATE OR REPLACE PROCEDURE only_local_execution_with_function_evaluation() AS $$ DECLARE nodeId INT; @@ -895,10 +895,10 @@ CREATE OR REPLACE PROCEDURE only_local_execution_with_function_evaluation() AS $ END; $$ LANGUAGE plpgsql; CALL only_local_execution_with_function_evaluation(); -NOTICE: executing the command locally: SELECT local_shard_execution.get_local_node_id_volatile() AS get_local_node_id_volatile FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT local_shard_execution.get_local_node_id_volatile() AS get_local_node_id_volatile FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) CONTEXT: SQL statement "SELECT get_local_node_id_volatile() FROM distributed_table WHERE key = 1" PL/pgSQL function only_local_execution_with_function_evaluation() line XX at SQL statement -NOTICE: executing the command locally: SELECT local_shard_execution.get_local_node_id_volatile() AS get_local_node_id_volatile FROM (local_shard_execution.distributed_table_1470001 d1(key, value, age) JOIN local_shard_execution.distributed_table_1470001 d2(key, value, age) USING (key)) WHERE (d1.key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT local_shard_execution.get_local_node_id_volatile() AS get_local_node_id_volatile FROM (local_shard_execution.distributed_table_xxxxxxx d1(key, value, age) JOIN local_shard_execution.distributed_table_xxxxxxx d2(key, value, age) USING (key)) WHERE (d1.key OPERATOR(pg_catalog.=) 1) CONTEXT: SQL statement "SELECT get_local_node_id_volatile() FROM distributed_table d1 JOIN distributed_table d2 USING (key) WHERE d1.key = 1" PL/pgSQL function only_local_execution_with_function_evaluation() line XX at SQL statement CREATE OR REPLACE PROCEDURE only_local_execution_with_params(int) AS $$ @@ -910,13 +910,13 @@ CREATE OR REPLACE PROCEDURE only_local_execution_with_params(int) AS $$ END; $$ LANGUAGE plpgsql; CALL only_local_execution_with_params(1); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '29'::text +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '29'::text CONTEXT: SQL statement "INSERT INTO distributed_table VALUES ($1, '11',21) ON CONFLICT(key) DO UPDATE SET value = '29'" PL/pgSQL function only_local_execution_with_params(integer) line XX at SQL statement -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) CONTEXT: SQL statement "SELECT count(*) FROM distributed_table WHERE key = $1" PL/pgSQL function only_local_execution_with_params(integer) line XX at SQL statement -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) CONTEXT: SQL statement "DELETE FROM distributed_table WHERE key = $1" PL/pgSQL function only_local_execution_with_params(integer) line XX at SQL statement CREATE OR REPLACE PROCEDURE only_local_execution_with_function_evaluation_param(int) AS $$ @@ -936,10 +936,10 @@ CREATE OR REPLACE PROCEDURE only_local_execution_with_function_evaluation_param( END; $$ LANGUAGE plpgsql; CALL only_local_execution_with_function_evaluation_param(1); -NOTICE: executing the command locally: SELECT local_shard_execution.get_local_node_id_volatile() AS get_local_node_id_volatile FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT local_shard_execution.get_local_node_id_volatile() AS get_local_node_id_volatile FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) CONTEXT: SQL statement "SELECT get_local_node_id_volatile() FROM distributed_table WHERE key = $1" PL/pgSQL function only_local_execution_with_function_evaluation_param(integer) line XX at SQL statement -NOTICE: executing the command locally: SELECT local_shard_execution.get_local_node_id_volatile() AS get_local_node_id_volatile FROM (local_shard_execution.distributed_table_1470001 d1(key, value, age) JOIN local_shard_execution.distributed_table_1470001 d2(key, value, age) USING (key)) WHERE (d1.key OPERATOR(pg_catalog.=) $1) +NOTICE: executing the command locally: SELECT local_shard_execution.get_local_node_id_volatile() AS get_local_node_id_volatile FROM (local_shard_execution.distributed_table_xxxxxxx d1(key, value, age) JOIN local_shard_execution.distributed_table_xxxxxxx d2(key, value, age) USING (key)) WHERE (d1.key OPERATOR(pg_catalog.=) $1) CONTEXT: SQL statement "SELECT get_local_node_id_volatile() FROM distributed_table d1 JOIN distributed_table d2 USING (key) WHERE d1.key = $1" PL/pgSQL function only_local_execution_with_function_evaluation_param(integer) line XX at SQL statement CREATE OR REPLACE PROCEDURE local_execution_followed_by_dist() AS $$ @@ -953,30 +953,30 @@ CREATE OR REPLACE PROCEDURE local_execution_followed_by_dist() AS $$ $$ LANGUAGE plpgsql; RESET citus.enable_metadata_sync; CALL local_execution_followed_by_dist(); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '29'::text +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '29'::text CONTEXT: SQL statement "INSERT INTO distributed_table VALUES (1, '11',21) ON CONFLICT(key) DO UPDATE SET value = '29'" PL/pgSQL function local_execution_followed_by_dist() line XX at SQL statement -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) CONTEXT: SQL statement "SELECT count(*) FROM distributed_table WHERE key = 1" PL/pgSQL function local_execution_followed_by_dist() line XX at SQL statement -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470001 distributed_table +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table CONTEXT: SQL statement "DELETE FROM distributed_table" PL/pgSQL function local_execution_followed_by_dist() line XX at SQL statement -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table CONTEXT: SQL statement "DELETE FROM distributed_table" PL/pgSQL function local_execution_followed_by_dist() line XX at SQL statement -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true CONTEXT: SQL statement "SELECT count(*) FROM distributed_table" PL/pgSQL function local_execution_followed_by_dist() line XX at SQL statement -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true CONTEXT: SQL statement "SELECT count(*) FROM distributed_table" PL/pgSQL function local_execution_followed_by_dist() line XX at SQL statement -- test CTEs, including modifying CTEs WITH local_insert AS (INSERT INTO distributed_table VALUES (1, '11',21) ON CONFLICT(key) DO UPDATE SET value = '29' RETURNING *), distributed_local_mixed AS (SELECT * FROM reference_table WHERE key IN (SELECT key FROM local_insert)) SELECT * FROM local_insert, distributed_local_mixed; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '29'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age -NOTICE: executing the command locally: SELECT key FROM local_shard_execution.reference_table_1470000 reference_table WHERE (key OPERATOR(pg_catalog.=) ANY (SELECT local_insert.key FROM (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.age FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, age bigint)) local_insert)) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '29'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age +NOTICE: executing the command locally: SELECT key FROM local_shard_execution.reference_table_xxxxxxx reference_table WHERE (key OPERATOR(pg_catalog.=) ANY (SELECT local_insert.key FROM (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.age FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, age bigint)) local_insert)) NOTICE: executing the command locally: SELECT local_insert.key, local_insert.value, local_insert.age, distributed_local_mixed.key FROM (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.age FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, age bigint)) local_insert, (SELECT intermediate_result.key FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) distributed_local_mixed key | value | age | key --------------------------------------------------------------------- @@ -988,9 +988,9 @@ NOTICE: executing the command locally: SELECT local_insert.key, local_insert.va WITH distributed_local_mixed AS (SELECT * FROM distributed_table), local_insert AS (INSERT INTO distributed_table VALUES (1, '11',21) ON CONFLICT(key) DO UPDATE SET value = '29' RETURNING *) SELECT * FROM local_insert, distributed_local_mixed ORDER BY 1,2,3,4,5; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '29'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age -NOTICE: executing the command locally: SELECT worker_column_1 AS key, worker_column_2 AS value, worker_column_3 AS age, worker_column_4 AS key, worker_column_5 AS value, worker_column_6 AS age FROM (SELECT local_insert.key AS worker_column_1, local_insert.value AS worker_column_2, local_insert.age AS worker_column_3, distributed_local_mixed.key AS worker_column_4, distributed_local_mixed.value AS worker_column_5, distributed_local_mixed.age AS worker_column_6 FROM (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.age FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, age bigint)) local_insert, (SELECT distributed_table.key, distributed_table.value, distributed_table.age FROM local_shard_execution.distributed_table_1470001 distributed_table) distributed_local_mixed) worker_subquery ORDER BY worker_column_1, worker_column_2, worker_column_3, worker_column_4, worker_column_5 -NOTICE: executing the command locally: SELECT worker_column_1 AS key, worker_column_2 AS value, worker_column_3 AS age, worker_column_4 AS key, worker_column_5 AS value, worker_column_6 AS age FROM (SELECT local_insert.key AS worker_column_1, local_insert.value AS worker_column_2, local_insert.age AS worker_column_3, distributed_local_mixed.key AS worker_column_4, distributed_local_mixed.value AS worker_column_5, distributed_local_mixed.age AS worker_column_6 FROM (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.age FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, age bigint)) local_insert, (SELECT distributed_table.key, distributed_table.value, distributed_table.age FROM local_shard_execution.distributed_table_1470003 distributed_table) distributed_local_mixed) worker_subquery ORDER BY worker_column_1, worker_column_2, worker_column_3, worker_column_4, worker_column_5 +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '29'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age +NOTICE: executing the command locally: SELECT worker_column_1 AS key, worker_column_2 AS value, worker_column_3 AS age, worker_column_4 AS key, worker_column_5 AS value, worker_column_6 AS age FROM (SELECT local_insert.key AS worker_column_1, local_insert.value AS worker_column_2, local_insert.age AS worker_column_3, distributed_local_mixed.key AS worker_column_4, distributed_local_mixed.value AS worker_column_5, distributed_local_mixed.age AS worker_column_6 FROM (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.age FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, age bigint)) local_insert, (SELECT distributed_table.key, distributed_table.value, distributed_table.age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table) distributed_local_mixed) worker_subquery ORDER BY worker_column_1, worker_column_2, worker_column_3, worker_column_4, worker_column_5 +NOTICE: executing the command locally: SELECT worker_column_1 AS key, worker_column_2 AS value, worker_column_3 AS age, worker_column_4 AS key, worker_column_5 AS value, worker_column_6 AS age FROM (SELECT local_insert.key AS worker_column_1, local_insert.value AS worker_column_2, local_insert.age AS worker_column_3, distributed_local_mixed.key AS worker_column_4, distributed_local_mixed.value AS worker_column_5, distributed_local_mixed.age AS worker_column_6 FROM (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.age FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, age bigint)) local_insert, (SELECT distributed_table.key, distributed_table.value, distributed_table.age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table) distributed_local_mixed) worker_subquery ORDER BY worker_column_1, worker_column_2, worker_column_3, worker_column_4, worker_column_5 key | value | age | key | value | age --------------------------------------------------------------------- 1 | 29 | 21 | 1 | 11 | 21 @@ -1004,14 +1004,14 @@ FROM distributed_table, all_data WHERE distributed_table.key = all_data.key AND distributed_table.key = 1; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table, (SELECT distributed_table_1.key, distributed_table_1.value, distributed_table_1.age FROM local_shard_execution.distributed_table_1470001 distributed_table_1 WHERE (distributed_table_1.key OPERATOR(pg_catalog.=) 1)) all_data WHERE ((distributed_table.key OPERATOR(pg_catalog.=) all_data.key) AND (distributed_table.key OPERATOR(pg_catalog.=) 1)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table, (SELECT distributed_table_1.key, distributed_table_1.value, distributed_table_1.age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table_1 WHERE (distributed_table_1.key OPERATOR(pg_catalog.=) 1)) all_data WHERE ((distributed_table.key OPERATOR(pg_catalog.=) all_data.key) AND (distributed_table.key OPERATOR(pg_catalog.=) 1)) count --------------------------------------------------------------------- 1 (1 row) INSERT INTO reference_table VALUES (2); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_1470000 (key) VALUES (2) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_xxxxxxx (key) VALUES (2) INSERT INTO distributed_table VALUES (2, '29', 29); INSERT INTO second_distributed_table VALUES (2, '29'); -- single shard that is not a local query followed by a local query @@ -1024,7 +1024,7 @@ WHERE distributed_table.value = all_data.value AND distributed_table.key = 1 ORDER BY 1 DESC; -NOTICE: executing the command locally: SELECT distributed_table.key FROM local_shard_execution.distributed_table_1470001 distributed_table, (SELECT intermediate_result.key, intermediate_result.value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text)) all_data WHERE ((distributed_table.value OPERATOR(pg_catalog.=) all_data.value) AND (distributed_table.key OPERATOR(pg_catalog.=) 1)) ORDER BY distributed_table.key DESC +NOTICE: executing the command locally: SELECT distributed_table.key FROM local_shard_execution.distributed_table_xxxxxxx distributed_table, (SELECT intermediate_result.key, intermediate_result.value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text)) all_data WHERE ((distributed_table.value OPERATOR(pg_catalog.=) all_data.value) AND (distributed_table.key OPERATOR(pg_catalog.=) 1)) ORDER BY distributed_table.key DESC key --------------------------------------------------------------------- 1 @@ -1043,9 +1043,9 @@ FROM WHERE distributed_table.key = all_data.key AND distributed_table.key = 1 AND EXISTS (SELECT * FROM all_data); -NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE true -NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE true -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table, (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.age FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, age bigint)) all_data WHERE ((distributed_table.key OPERATOR(pg_catalog.=) all_data.key) AND (distributed_table.key OPERATOR(pg_catalog.=) 1) AND (EXISTS (SELECT all_data_1.key, all_data_1.value, all_data_1.age FROM (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.age FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, age bigint)) all_data_1))) +NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true +NOTICE: executing the command locally: SELECT key, value, age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table, (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.age FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, age bigint)) all_data WHERE ((distributed_table.key OPERATOR(pg_catalog.=) all_data.key) AND (distributed_table.key OPERATOR(pg_catalog.=) 1) AND (EXISTS (SELECT all_data_1.key, all_data_1.value, all_data_1.age FROM (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.age FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, age bigint)) all_data_1))) count --------------------------------------------------------------------- 1 @@ -1061,9 +1061,9 @@ FROM distributed_table, all_data WHERE distributed_table.key = all_data.age AND distributed_table.key = 1; -NOTICE: executing the command locally: SELECT age FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE true -NOTICE: executing the command locally: SELECT age FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE true -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table, (SELECT intermediate_result.age FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(age bigint)) all_data WHERE ((distributed_table.key OPERATOR(pg_catalog.=) all_data.age) AND (distributed_table.key OPERATOR(pg_catalog.=) 1)) +NOTICE: executing the command locally: SELECT age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true +NOTICE: executing the command locally: SELECT age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table, (SELECT intermediate_result.age FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(age bigint)) all_data WHERE ((distributed_table.key OPERATOR(pg_catalog.=) all_data.age) AND (distributed_table.key OPERATOR(pg_catalog.=) 1)) count --------------------------------------------------------------------- 0 @@ -1084,7 +1084,7 @@ NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.sec NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.second_distributed_table_xxxxx CASCADE -- local execution of returning of reference tables INSERT INTO reference_table VALUES (1),(2),(3),(4),(5),(6) RETURNING *; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_1470000 AS citus_table_alias (key) VALUES (1), (2), (3), (4), (5), (6) RETURNING citus_table_alias.key +NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_xxxxxxx AS citus_table_alias (key) VALUES (1), (2), (3), (4), (5), (6) RETURNING citus_table_alias.key key --------------------------------------------------------------------- 1 @@ -1097,7 +1097,7 @@ NOTICE: executing the command locally: INSERT INTO local_shard_execution.refere -- local execution of multi-row INSERTs INSERT INTO distributed_table VALUES (1, '11',21), (5,'55',22) ON CONFLICT(key) DO UPDATE SET value = (EXCLUDED.value::int + 1)::text RETURNING *; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1,'11'::text,'21'::bigint), (5,'55'::text,'22'::bigint) ON CONFLICT(key) DO UPDATE SET value = (((excluded.value)::integer OPERATOR(pg_catalog.+) 1))::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1,'11'::text,'21'::bigint), (5,'55'::text,'22'::bigint) ON CONFLICT(key) DO UPDATE SET value = (((excluded.value)::integer OPERATOR(pg_catalog.+) 1))::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age key | value | age --------------------------------------------------------------------- 1 | 11 | 21 @@ -1107,7 +1107,7 @@ NOTICE: executing the command locally: INSERT INTO local_shard_execution.distri -- distributed execution of multi-rows INSERTs, where executor -- is smart enough to execute local tasks via local execution INSERT INTO distributed_table VALUES (1, '11',21), (2,'22',22), (3,'33',33), (4,'44',44),(5,'55',55) ON CONFLICT(key) DO UPDATE SET value = (EXCLUDED.value::int + 1)::text RETURNING *; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1,'11'::text,'21'::bigint), (5,'55'::text,'55'::bigint) ON CONFLICT(key) DO UPDATE SET value = (((excluded.value)::integer OPERATOR(pg_catalog.+) 1))::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1,'11'::text,'21'::bigint), (5,'55'::text,'55'::bigint) ON CONFLICT(key) DO UPDATE SET value = (((excluded.value)::integer OPERATOR(pg_catalog.+) 1))::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age key | value | age --------------------------------------------------------------------- 1 | 12 | 21 @@ -1132,56 +1132,56 @@ PREPARE remote_prepare_param (int) AS SELECT count(*) FROM distributed_table WHE BEGIN; -- 8 local execution without params EXECUTE local_prepare_no_param; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) count --------------------------------------------------------------------- 1 (1 row) EXECUTE local_prepare_no_param; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) count --------------------------------------------------------------------- 1 (1 row) EXECUTE local_prepare_no_param; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) count --------------------------------------------------------------------- 1 (1 row) EXECUTE local_prepare_no_param; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) count --------------------------------------------------------------------- 1 (1 row) EXECUTE local_prepare_no_param; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) count --------------------------------------------------------------------- 1 (1 row) EXECUTE local_prepare_no_param; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) count --------------------------------------------------------------------- 1 (1 row) EXECUTE local_prepare_no_param; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) count --------------------------------------------------------------------- 1 (1 row) EXECUTE local_prepare_no_param; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) count --------------------------------------------------------------------- 1 @@ -1189,8 +1189,8 @@ NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shar -- 8 local execution without params and some subqueries EXECUTE local_prepare_no_param_subquery; -NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint -NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint +NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint +NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint NOTICE: executing the command locally: SELECT DISTINCT TRIM(BOTH FROM value) AS btrim FROM (SELECT intermediate_result.value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value text)) t btrim --------------------------------------------------------------------- @@ -1198,8 +1198,8 @@ NOTICE: executing the command locally: SELECT DISTINCT TRIM(BOTH FROM value) AS (1 row) EXECUTE local_prepare_no_param_subquery; -NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint -NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint +NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint +NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint NOTICE: executing the command locally: SELECT DISTINCT TRIM(BOTH FROM value) AS btrim FROM (SELECT intermediate_result.value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value text)) t btrim --------------------------------------------------------------------- @@ -1207,8 +1207,8 @@ NOTICE: executing the command locally: SELECT DISTINCT TRIM(BOTH FROM value) AS (1 row) EXECUTE local_prepare_no_param_subquery; -NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint -NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint +NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint +NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint NOTICE: executing the command locally: SELECT DISTINCT TRIM(BOTH FROM value) AS btrim FROM (SELECT intermediate_result.value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value text)) t btrim --------------------------------------------------------------------- @@ -1216,8 +1216,8 @@ NOTICE: executing the command locally: SELECT DISTINCT TRIM(BOTH FROM value) AS (1 row) EXECUTE local_prepare_no_param_subquery; -NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint -NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint +NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint +NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint NOTICE: executing the command locally: SELECT DISTINCT TRIM(BOTH FROM value) AS btrim FROM (SELECT intermediate_result.value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value text)) t btrim --------------------------------------------------------------------- @@ -1225,8 +1225,8 @@ NOTICE: executing the command locally: SELECT DISTINCT TRIM(BOTH FROM value) AS (1 row) EXECUTE local_prepare_no_param_subquery; -NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint -NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint +NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint +NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint NOTICE: executing the command locally: SELECT DISTINCT TRIM(BOTH FROM value) AS btrim FROM (SELECT intermediate_result.value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value text)) t btrim --------------------------------------------------------------------- @@ -1234,8 +1234,8 @@ NOTICE: executing the command locally: SELECT DISTINCT TRIM(BOTH FROM value) AS (1 row) EXECUTE local_prepare_no_param_subquery; -NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint -NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint +NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint +NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint NOTICE: executing the command locally: SELECT DISTINCT TRIM(BOTH FROM value) AS btrim FROM (SELECT intermediate_result.value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value text)) t btrim --------------------------------------------------------------------- @@ -1243,8 +1243,8 @@ NOTICE: executing the command locally: SELECT DISTINCT TRIM(BOTH FROM value) AS (1 row) EXECUTE local_prepare_no_param_subquery; -NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint -NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint +NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint +NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint NOTICE: executing the command locally: SELECT DISTINCT TRIM(BOTH FROM value) AS btrim FROM (SELECT intermediate_result.value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value text)) t btrim --------------------------------------------------------------------- @@ -1252,8 +1252,8 @@ NOTICE: executing the command locally: SELECT DISTINCT TRIM(BOTH FROM value) AS (1 row) EXECUTE local_prepare_no_param_subquery; -NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint -NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint +NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint +NOTICE: executing the command locally: SELECT worker_column_1 AS value FROM (SELECT distributed_table.value AS worker_column_1 FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE ((distributed_table.key OPERATOR(pg_catalog.=) ANY (ARRAY[1, 6, 500, 701])) AND (((SELECT 2))::double precision OPERATOR(pg_catalog.>) random()))) worker_subquery ORDER BY worker_column_1 LIMIT '2'::bigint NOTICE: executing the command locally: SELECT DISTINCT TRIM(BOTH FROM value) AS btrim FROM (SELECT intermediate_result.value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value text)) t btrim --------------------------------------------------------------------- @@ -1262,56 +1262,56 @@ NOTICE: executing the command locally: SELECT DISTINCT TRIM(BOTH FROM value) AS -- 8 local executions with params EXECUTE local_prepare_param(1); -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) count --------------------------------------------------------------------- 1 (1 row) EXECUTE local_prepare_param(5); -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 5) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 5) count --------------------------------------------------------------------- 1 (1 row) EXECUTE local_prepare_param(6); -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.=) 6) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 6) count --------------------------------------------------------------------- 0 (1 row) EXECUTE local_prepare_param(1); -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) count --------------------------------------------------------------------- 1 (1 row) EXECUTE local_prepare_param(5); -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 5) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 5) count --------------------------------------------------------------------- 1 (1 row) EXECUTE local_prepare_param(6); -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.=) 6) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 6) count --------------------------------------------------------------------- 0 (1 row) EXECUTE local_prepare_param(6); -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.=) 6) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 6) count --------------------------------------------------------------------- 0 (1 row) EXECUTE local_prepare_param(6); -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.=) 6) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 6) count --------------------------------------------------------------------- 0 @@ -1319,8 +1319,8 @@ NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shar -- followed by a non-local execution EXECUTE remote_prepare_param(1); -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.<>) 1) -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.<>) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.<>) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.<>) 1) count --------------------------------------------------------------------- 4 @@ -1332,56 +1332,56 @@ PREPARE local_insert_prepare_param (int) AS INSERT INTO distributed_table VALUES BEGIN; -- 8 local execution without params EXECUTE local_insert_prepare_no_param; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) key | value | age | ?column? | ?column? | ?column? --------------------------------------------------------------------- 1 | 2928 | 21 | 2 | 292830 | 315 (1 row) EXECUTE local_insert_prepare_no_param; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) key | value | age | ?column? | ?column? | ?column? --------------------------------------------------------------------- 1 | 2928 | 21 | 2 | 292830 | 315 (1 row) EXECUTE local_insert_prepare_no_param; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) key | value | age | ?column? | ?column? | ?column? --------------------------------------------------------------------- 1 | 2928 | 21 | 2 | 292830 | 315 (1 row) EXECUTE local_insert_prepare_no_param; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) key | value | age | ?column? | ?column? | ?column? --------------------------------------------------------------------- 1 | 2928 | 21 | 2 | 292830 | 315 (1 row) EXECUTE local_insert_prepare_no_param; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) key | value | age | ?column? | ?column? | ?column? --------------------------------------------------------------------- 1 | 2928 | 21 | 2 | 292830 | 315 (1 row) EXECUTE local_insert_prepare_no_param; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) key | value | age | ?column? | ?column? | ?column? --------------------------------------------------------------------- 1 | 2928 | 21 | 2 | 292830 | 315 (1 row) EXECUTE local_insert_prepare_no_param; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) key | value | age | ?column? | ?column? | ?column? --------------------------------------------------------------------- 1 | 2928 | 21 | 2 | 292830 | 315 (1 row) EXECUTE local_insert_prepare_no_param; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) key | value | age | ?column? | ?column? | ?column? --------------------------------------------------------------------- 1 | 2928 | 21 | 2 | 292830 | 315 @@ -1389,56 +1389,56 @@ NOTICE: executing the command locally: INSERT INTO local_shard_execution.distri -- 8 local executions with params EXECUTE local_insert_prepare_param(1); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) key | value | age | ?column? | ?column? | ?column? --------------------------------------------------------------------- 1 | 2928 | 21 | 2 | 292830 | 315 (1 row) EXECUTE local_insert_prepare_param(5); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (5, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (5, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) key | value | age | ?column? | ?column? | ?column? --------------------------------------------------------------------- 5 | 2928 | 22 | 6 | 292830 | 330 (1 row) EXECUTE local_insert_prepare_param(6); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470003 AS citus_table_alias (key, value, age) VALUES (6, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (6, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) key | value | age | ?column? | ?column? | ?column? --------------------------------------------------------------------- 6 | 11 | 21 | 7 | 1130 | 315 (1 row) EXECUTE local_insert_prepare_param(1); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) key | value | age | ?column? | ?column? | ?column? --------------------------------------------------------------------- 1 | 2928 | 21 | 2 | 292830 | 315 (1 row) EXECUTE local_insert_prepare_param(5); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (5, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (5, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) key | value | age | ?column? | ?column? | ?column? --------------------------------------------------------------------- 5 | 2928 | 22 | 6 | 292830 | 330 (1 row) EXECUTE local_insert_prepare_param(6); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470003 AS citus_table_alias (key, value, age) VALUES (6, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (6, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) key | value | age | ?column? | ?column? | ?column? --------------------------------------------------------------------- 6 | 2928 | 21 | 7 | 292830 | 315 (1 row) EXECUTE local_insert_prepare_param(6); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470003 AS citus_table_alias (key, value, age) VALUES (6, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (6, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) key | value | age | ?column? | ?column? | ?column? --------------------------------------------------------------------- 6 | 2928 | 21 | 7 | 292830 | 315 (1 row) EXECUTE local_insert_prepare_param(6); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470003 AS citus_table_alias (key, value, age) VALUES (6, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (6, '11'::text, '21'::bigint) ON CONFLICT(key) DO UPDATE SET value = '2928'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age, (citus_table_alias.key OPERATOR(pg_catalog.+) 1), (citus_table_alias.value OPERATOR(pg_catalog.||) '30'::text), (citus_table_alias.age OPERATOR(pg_catalog.*) 15) key | value | age | ?column? | ?column? | ?column? --------------------------------------------------------------------- 6 | 2928 | 21 | 7 | 292830 | 315 @@ -1446,8 +1446,8 @@ NOTICE: executing the command locally: INSERT INTO local_shard_execution.distri -- followed by a non-local execution EXECUTE remote_prepare_param(2); -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.<>) 2) -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.<>) 2) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.<>) 2) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.<>) 2) count --------------------------------------------------------------------- 5 @@ -1461,104 +1461,104 @@ PREPARE local_multi_row_insert_prepare_no_param_multi_shard AS PREPARE local_multi_row_insert_prepare_params(int,int) AS INSERT INTO distributed_table VALUES ($1,'55', 21), ($2,'15',33) ON CONFLICT (key) WHERE key > 3 and key < 4 DO UPDATE SET value = '88' || EXCLUDED.value;; INSERT INTO reference_table VALUES (11); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_1470000 (key) VALUES (11) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_xxxxxxx (key) VALUES (11) BEGIN; EXECUTE local_multi_row_insert_prepare_no_param; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_no_param; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_no_param; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_no_param; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_no_param; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_no_param; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_no_param; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_no_param; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_no_param_multi_shard; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470003 AS citus_table_alias (key, value, age) VALUES (6,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (6,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_no_param_multi_shard; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470003 AS citus_table_alias (key, value, age) VALUES (6,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (6,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_no_param_multi_shard; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470003 AS citus_table_alias (key, value, age) VALUES (6,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (6,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_no_param_multi_shard; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470003 AS citus_table_alias (key, value, age) VALUES (6,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (6,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_no_param_multi_shard; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470003 AS citus_table_alias (key, value, age) VALUES (6,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (6,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_no_param_multi_shard; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470003 AS citus_table_alias (key, value, age) VALUES (6,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (6,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_no_param_multi_shard; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470003 AS citus_table_alias (key, value, age) VALUES (6,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (6,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_no_param_multi_shard; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470003 AS citus_table_alias (key, value, age) VALUES (6,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (6,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_params(1,6); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470003 AS citus_table_alias (key, value, age) VALUES (6,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (6,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_params(1,5); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_params(6,5); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470003 AS citus_table_alias (key, value, age) VALUES (6,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (6,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_params(5,1); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (5,'55'::text,'21'::bigint), (1,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (5,'55'::text,'21'::bigint), (1,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_params(5,6); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (5,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470003 AS citus_table_alias (key, value, age) VALUES (6,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (5,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (6,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_params(5,1); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (5,'55'::text,'21'::bigint), (1,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (5,'55'::text,'21'::bigint), (1,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_params(1,6); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470003 AS citus_table_alias (key, value, age) VALUES (6,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (6,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) EXECUTE local_multi_row_insert_prepare_params(1,5); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1,'55'::text,'21'::bigint), (5,'15'::text,'33'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) -- one task is remote EXECUTE local_multi_row_insert_prepare_params(5,11); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (5,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (5,'55'::text,'21'::bigint) ON CONFLICT(key) WHERE ((key OPERATOR(pg_catalog.>) 3) AND (key OPERATOR(pg_catalog.<) 4)) DO UPDATE SET value = ('88'::text OPERATOR(pg_catalog.||) excluded.value) ROLLBACK; -- make sure that we still get results if we switch off local execution PREPARE ref_count_prepare AS SELECT count(*) FROM reference_table; EXECUTE ref_count_prepare; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.reference_table_1470000 reference_table +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.reference_table_xxxxxxx reference_table count --------------------------------------------------------------------- 7 (1 row) EXECUTE ref_count_prepare; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.reference_table_1470000 reference_table +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.reference_table_xxxxxxx reference_table count --------------------------------------------------------------------- 7 (1 row) EXECUTE ref_count_prepare; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.reference_table_1470000 reference_table +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.reference_table_xxxxxxx reference_table count --------------------------------------------------------------------- 7 (1 row) EXECUTE ref_count_prepare; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.reference_table_1470000 reference_table +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.reference_table_xxxxxxx reference_table count --------------------------------------------------------------------- 7 (1 row) EXECUTE ref_count_prepare; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.reference_table_1470000 reference_table +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.reference_table_xxxxxxx reference_table count --------------------------------------------------------------------- 7 @@ -1577,17 +1577,17 @@ RESET citus.enable_local_execution; -- fail on a local execution BEGIN; INSERT INTO distributed_table VALUES (1, '11',21) ON CONFLICT(key) DO UPDATE SET value = '100' RETURNING *; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '100'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '100'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age key | value | age --------------------------------------------------------------------- 1 | 100 | 21 (1 row) UPDATE distributed_table SET value = '200'; -NOTICE: executing the command locally: UPDATE local_shard_execution.distributed_table_1470001 distributed_table SET value = '200'::text -NOTICE: executing the command locally: UPDATE local_shard_execution.distributed_table_1470003 distributed_table SET value = '200'::text +NOTICE: executing the command locally: UPDATE local_shard_execution.distributed_table_xxxxxxx distributed_table SET value = '200'::text +NOTICE: executing the command locally: UPDATE local_shard_execution.distributed_table_xxxxxxx distributed_table SET value = '200'::text INSERT INTO distributed_table VALUES (1, '100',21) ON CONFLICT(key) DO UPDATE SET value = (1 / (100.0 - EXCLUDED.value::int))::text RETURNING *; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '100'::text, 21) ON CONFLICT(key) DO UPDATE SET value = (((1)::numeric OPERATOR(pg_catalog./) (100.0 OPERATOR(pg_catalog.-) ((excluded.value)::integer)::numeric)))::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '100'::text, 21) ON CONFLICT(key) DO UPDATE SET value = (((1)::numeric OPERATOR(pg_catalog./) (100.0 OPERATOR(pg_catalog.-) ((excluded.value)::integer)::numeric)))::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age ERROR: division by zero ROLLBACK; -- we've rollbacked everything @@ -1599,14 +1599,14 @@ SELECT count(*) FROM distributed_table WHERE value = '200'; -- RETURNING should just work fine for reference tables INSERT INTO reference_table VALUES (500) RETURNING *; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_1470000 (key) VALUES (500) RETURNING key +NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_xxxxxxx (key) VALUES (500) RETURNING key key --------------------------------------------------------------------- 500 (1 row) DELETE FROM reference_table WHERE key = 500 RETURNING *; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.reference_table_1470000 reference_table WHERE (key OPERATOR(pg_catalog.=) 500) RETURNING key +NOTICE: executing the command locally: DELETE FROM local_shard_execution.reference_table_xxxxxxx reference_table WHERE (key OPERATOR(pg_catalog.=) 500) RETURNING key key --------------------------------------------------------------------- 500 @@ -1616,10 +1616,10 @@ NOTICE: executing the command locally: DELETE FROM local_shard_execution.refere BEGIN; SET LOCAL citus.multi_shard_modify_mode TO sequential ; DELETE FROM distributed_table; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470001 distributed_table -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table INSERT INTO distributed_table VALUES (1, '11',21) ON CONFLICT(key) DO UPDATE SET value = '100' RETURNING *; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '100'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '100'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age key | value | age --------------------------------------------------------------------- 1 | 11 | 21 @@ -1630,15 +1630,15 @@ ROLLBACK; BEGIN; SET citus.multi_shard_modify_mode TO sequential ; INSERT INTO distributed_table VALUES (1, '11',21) ON CONFLICT(key) DO UPDATE SET value = '100' RETURNING *; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '100'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '100'::text RETURNING citus_table_alias.key, citus_table_alias.value, citus_table_alias.age key | value | age --------------------------------------------------------------------- 1 | 100 | 21 (1 row) DELETE FROM distributed_table; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470001 distributed_table -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table ROLLBACK; -- load some data so that foreign keys won't complain with the next tests TRUNCATE reference_table CASCADE; @@ -1664,28 +1664,28 @@ NOTICE: executing the copy locally for shard xxxxx -- calculate rows processed correctly BEGIN; DELETE FROM distributed_table WHERE key = 500; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.=) 500) +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 500) DELETE FROM distributed_table WHERE value != '123123213123213'; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (value OPERATOR(pg_catalog.<>) '123123213123213'::text) -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (value OPERATOR(pg_catalog.<>) '123123213123213'::text) +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (value OPERATOR(pg_catalog.<>) '123123213123213'::text) +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (value OPERATOR(pg_catalog.<>) '123123213123213'::text) ROLLBACK; BEGIN; DELETE FROM reference_table WHERE key = 500 RETURNING *; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.reference_table_1470000 reference_table WHERE (key OPERATOR(pg_catalog.=) 500) RETURNING key +NOTICE: executing the command locally: DELETE FROM local_shard_execution.reference_table_xxxxxxx reference_table WHERE (key OPERATOR(pg_catalog.=) 500) RETURNING key key --------------------------------------------------------------------- 500 (1 row) DELETE FROM reference_table; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.reference_table_1470000 reference_table +NOTICE: executing the command locally: DELETE FROM local_shard_execution.reference_table_xxxxxxx reference_table ROLLBACK; BEGIN; DELETE FROM distributed_table WHERE key = 500; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.=) 500) +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 500) SELECT count(*) FROM distributed_table; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE true -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true count --------------------------------------------------------------------- 100 @@ -1695,8 +1695,8 @@ ROLLBACK; BEGIN; SET LOCAL client_min_messages TO INFO; SELECT count(*) FROM distributed_table; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE true -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true count --------------------------------------------------------------------- 101 @@ -1704,7 +1704,7 @@ NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shar SET LOCAL client_min_messages TO LOG; DELETE FROM distributed_table WHERE key = 500; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.=) 500) +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 500) ROLLBACK; -- probably not a realistic case since views are not very -- well supported with MX @@ -1713,7 +1713,7 @@ CREATE VIEW v_local_query_execution AS SELECT * FROM distributed_table WHERE key = 500; RESET citus.enable_ddl_propagation; SELECT * FROM v_local_query_execution; -NOTICE: executing the command locally: SELECT key, value, age FROM (SELECT distributed_table.key, distributed_table.value, distributed_table.age FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (distributed_table.key OPERATOR(pg_catalog.=) 500)) v_local_query_execution +NOTICE: executing the command locally: SELECT key, value, age FROM (SELECT distributed_table.key, distributed_table.value, distributed_table.age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (distributed_table.key OPERATOR(pg_catalog.=) 500)) v_local_query_execution key | value | age --------------------------------------------------------------------- 500 | 500 | 25 @@ -1726,7 +1726,7 @@ CREATE VIEW v_local_query_execution_2 AS SELECT * FROM distributed_table; RESET citus.enable_ddl_propagation; SELECT * FROM v_local_query_execution_2 WHERE key = 500; -NOTICE: executing the command locally: SELECT key, value, age FROM (SELECT distributed_table.key, distributed_table.value, distributed_table.age FROM local_shard_execution.distributed_table_1470003 distributed_table) v_local_query_execution_2 WHERE (key OPERATOR(pg_catalog.=) 500) +NOTICE: executing the command locally: SELECT key, value, age FROM (SELECT distributed_table.key, distributed_table.value, distributed_table.age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table) v_local_query_execution_2 WHERE (key OPERATOR(pg_catalog.=) 500) key | value | age --------------------------------------------------------------------- 500 | 500 | 25 @@ -1737,28 +1737,28 @@ NOTICE: executing the command locally: SELECT key, value, age FROM (SELECT dist BEGIN; SAVEPOINT my_savepoint; SELECT count(*) FROM distributed_table; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE true -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true count --------------------------------------------------------------------- 101 (1 row) DELETE FROM distributed_table WHERE key = 500; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.=) 500) +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 500) ROLLBACK TO SAVEPOINT my_savepoint; DELETE FROM distributed_table WHERE key = 500; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.=) 500) +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 500) COMMIT; -- even if we switch from local execution -> remote execution, -- we are able to use local execution after rollback BEGIN; SAVEPOINT my_savepoint; DELETE FROM distributed_table WHERE key = 500; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.=) 500) +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 500) SELECT count(*) FROM distributed_table; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE true -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE true count --------------------------------------------------------------------- 100 @@ -1766,11 +1766,11 @@ NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shar ROLLBACK TO SAVEPOINT my_savepoint; DELETE FROM distributed_table WHERE key = 500; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.=) 500) +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table WHERE (key OPERATOR(pg_catalog.=) 500) COMMIT; -- sanity check: local execution on partitions INSERT INTO collections_list (collection_id) VALUES (0) RETURNING *; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_1470011 (key, ser, collection_id) VALUES ('3940649673949185'::bigint, '3940649673949185'::bigint, 0) RETURNING key, ser, ts, collection_id, value +NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_xxxxxxx (key, ser, collection_id) VALUES ('3940649673949185'::bigint, '3940649673949185'::bigint, 0) RETURNING key, ser, ts, collection_id, value key | ser | ts | collection_id | value --------------------------------------------------------------------- 3940649673949185 | 3940649673949185 | | 0 | @@ -1778,25 +1778,25 @@ NOTICE: executing the command locally: INSERT INTO local_shard_execution.collec BEGIN; INSERT INTO collections_list (key, collection_id) VALUES (1,0); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_1470009 (key, ser, collection_id) VALUES ('1'::bigint, '3940649673949186'::bigint, 0) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_xxxxxxx (key, ser, collection_id) VALUES ('1'::bigint, '3940649673949186'::bigint, 0) SELECT count(*) FROM collections_list_0 WHERE key = 1; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.collections_list_0_1470013 collections_list_0 WHERE (key OPERATOR(pg_catalog.=) 1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.collections_list_0_xxxxxxx collections_list_0 WHERE (key OPERATOR(pg_catalog.=) 1) count --------------------------------------------------------------------- 1 (1 row) SELECT count(*) FROM collections_list; -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.collections_list_1470009 collections_list WHERE true -NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.collections_list_1470011 collections_list WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.collections_list_xxxxxxx collections_list WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.collections_list_xxxxxxx collections_list WHERE true count --------------------------------------------------------------------- 2 (1 row) SELECT * FROM collections_list ORDER BY 1,2,3,4; -NOTICE: executing the command locally: SELECT key, ser, ts, collection_id, value FROM local_shard_execution.collections_list_1470009 collections_list WHERE true ORDER BY key, ser, ts, collection_id -NOTICE: executing the command locally: SELECT key, ser, ts, collection_id, value FROM local_shard_execution.collections_list_1470011 collections_list WHERE true ORDER BY key, ser, ts, collection_id +NOTICE: executing the command locally: SELECT key, ser, ts, collection_id, value FROM local_shard_execution.collections_list_xxxxxxx collections_list WHERE true ORDER BY key, ser, ts, collection_id +NOTICE: executing the command locally: SELECT key, ser, ts, collection_id, value FROM local_shard_execution.collections_list_xxxxxxx collections_list WHERE true ORDER BY key, ser, ts, collection_id key | ser | ts | collection_id | value --------------------------------------------------------------------- 1 | 3940649673949186 | | 0 | @@ -1818,7 +1818,7 @@ SELECT setval('collections_list_key_seq', 4); (1 row) EXECUTE serial_prepared_local; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_1470009 (key, ser, collection_id) VALUES ('5'::bigint, '3940649673949187'::bigint, 0) RETURNING key, ser +NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_xxxxxxx (key, ser, collection_id) VALUES ('5'::bigint, '3940649673949187'::bigint, 0) RETURNING key, ser key | ser --------------------------------------------------------------------- 5 | 3940649673949187 @@ -1831,7 +1831,7 @@ SELECT setval('collections_list_key_seq', 5); (1 row) EXECUTE serial_prepared_local; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_1470011 (key, ser, collection_id) VALUES ('6'::bigint, '3940649673949188'::bigint, 0) RETURNING key, ser +NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_xxxxxxx (key, ser, collection_id) VALUES ('6'::bigint, '3940649673949188'::bigint, 0) RETURNING key, ser key | ser --------------------------------------------------------------------- 6 | 3940649673949188 @@ -1844,7 +1844,7 @@ SELECT setval('collections_list_key_seq', 499); (1 row) EXECUTE serial_prepared_local; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_1470011 (key, ser, collection_id) VALUES ('500'::bigint, '3940649673949189'::bigint, 0) RETURNING key, ser +NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_xxxxxxx (key, ser, collection_id) VALUES ('500'::bigint, '3940649673949189'::bigint, 0) RETURNING key, ser key | ser --------------------------------------------------------------------- 500 | 3940649673949189 @@ -1857,7 +1857,7 @@ SELECT setval('collections_list_key_seq', 700); (1 row) EXECUTE serial_prepared_local; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_1470009 (key, ser, collection_id) VALUES ('701'::bigint, '3940649673949190'::bigint, 0) RETURNING key, ser +NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_xxxxxxx (key, ser, collection_id) VALUES ('701'::bigint, '3940649673949190'::bigint, 0) RETURNING key, ser key | ser --------------------------------------------------------------------- 701 | 3940649673949190 @@ -1870,7 +1870,7 @@ SELECT setval('collections_list_key_seq', 708); (1 row) EXECUTE serial_prepared_local; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_1470011 (key, ser, collection_id) VALUES ('709'::bigint, '3940649673949191'::bigint, 0) RETURNING key, ser +NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_xxxxxxx (key, ser, collection_id) VALUES ('709'::bigint, '3940649673949191'::bigint, 0) RETURNING key, ser key | ser --------------------------------------------------------------------- 709 | 3940649673949191 @@ -1883,7 +1883,7 @@ SELECT setval('collections_list_key_seq', 709); (1 row) EXECUTE serial_prepared_local; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_1470009 (key, ser, collection_id) VALUES ('710'::bigint, '3940649673949192'::bigint, 0) RETURNING key, ser +NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_xxxxxxx (key, ser, collection_id) VALUES ('710'::bigint, '3940649673949192'::bigint, 0) RETURNING key, ser key | ser --------------------------------------------------------------------- 710 | 3940649673949192 @@ -1898,7 +1898,7 @@ SELECT setval('collections_list_key_seq', 4); (1 row) EXECUTE serial_prepared_local; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_1470009 (key, ser, collection_id) VALUES ('5'::bigint, '3940649673949193'::bigint, 0) RETURNING key, ser +NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_xxxxxxx (key, ser, collection_id) VALUES ('5'::bigint, '3940649673949193'::bigint, 0) RETURNING key, ser key | ser --------------------------------------------------------------------- 5 | 3940649673949193 @@ -1911,7 +1911,7 @@ SELECT setval('collections_list_key_seq', 5); (1 row) EXECUTE serial_prepared_local; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_1470011 (key, ser, collection_id) VALUES ('6'::bigint, '3940649673949194'::bigint, 0) RETURNING key, ser +NOTICE: executing the command locally: INSERT INTO local_shard_execution.collections_list_xxxxxxx (key, ser, collection_id) VALUES ('6'::bigint, '3940649673949194'::bigint, 0) RETURNING key, ser key | ser --------------------------------------------------------------------- 6 | 3940649673949194 @@ -1934,7 +1934,7 @@ EXECUTE serial_prepared_local; -- one of them will be executed remotely, and the other is locally -- Citus currently doesn't allow using task_assignment_policy for intermediate results WITH distributed_local_mixed AS (INSERT INTO reference_table VALUES (1000) RETURNING *) SELECT * FROM distributed_local_mixed; -NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_1470000 (key) VALUES (1000) RETURNING key +NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_xxxxxxx (key) VALUES (1000) RETURNING key NOTICE: executing the command locally: SELECT key FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) distributed_local_mixed key --------------------------------------------------------------------- @@ -1947,15 +1947,15 @@ TRUNCATE distributed_table CASCADE; NOTICE: truncate cascades to table "second_distributed_table" -- load some data on a remote shard INSERT INTO reference_table (key) VALUES (1), (2); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_1470000 AS citus_table_alias (key) VALUES (1), (2) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_xxxxxxx AS citus_table_alias (key) VALUES (1), (2) INSERT INTO distributed_table (key) VALUES (2); BEGIN; -- local execution followed by a distributed query INSERT INTO distributed_table (key) VALUES (1); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 (key) VALUES (1) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_xxxxxxx (key) VALUES (1) DELETE FROM distributed_table RETURNING key; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470001 distributed_table RETURNING key -NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table RETURNING key +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table RETURNING key +NOTICE: executing the command locally: DELETE FROM local_shard_execution.distributed_table_xxxxxxx distributed_table RETURNING key key --------------------------------------------------------------------- 1 @@ -1980,13 +1980,13 @@ NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.sec NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.second_distributed_table_xxxxx CASCADE -- load some data on a remote shard INSERT INTO reference_table (key) VALUES (2); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_1470000 (key) VALUES (2) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_xxxxxxx (key) VALUES (2) BEGIN; -- local execution followed by a distributed query INSERT INTO reference_table (key) VALUES (1); -NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_1470000 (key) VALUES (1) +NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_xxxxxxx (key) VALUES (1) DELETE FROM reference_table RETURNING key; -NOTICE: executing the command locally: DELETE FROM local_shard_execution.reference_table_1470000 reference_table RETURNING key +NOTICE: executing the command locally: DELETE FROM local_shard_execution.reference_table_xxxxxxx reference_table RETURNING key key --------------------------------------------------------------------- 1 @@ -2013,7 +2013,7 @@ WHERE distributed_table.key = 1 (SELECT key FROM distributed_table WHERE key = 1); -NOTICE: executing the command locally: SELECT count(*) AS count FROM ((SELECT foo.key, foo.value, foo.age FROM (SELECT cte_1_1.key, cte_1_1.value, cte_1_1.age FROM (SELECT distributed_table_1.key, distributed_table_1.value, distributed_table_1.age FROM local_shard_execution.distributed_table_1470001 distributed_table_1 WHERE (distributed_table_1.key OPERATOR(pg_catalog.=) 1)) cte_1_1) foo) cte_1 JOIN local_shard_execution.distributed_table_1470001 distributed_table(key, value, age) USING (key)) WHERE ((distributed_table.key OPERATOR(pg_catalog.=) 1) AND (distributed_table.key OPERATOR(pg_catalog.=) ANY (SELECT distributed_table_1.key FROM local_shard_execution.distributed_table_1470001 distributed_table_1 WHERE (distributed_table_1.key OPERATOR(pg_catalog.=) 1)))) +NOTICE: executing the command locally: SELECT count(*) AS count FROM ((SELECT foo.key, foo.value, foo.age FROM (SELECT cte_1_1.key, cte_1_1.value, cte_1_1.age FROM (SELECT distributed_table_1.key, distributed_table_1.value, distributed_table_1.age FROM local_shard_execution.distributed_table_xxxxxxx distributed_table_1 WHERE (distributed_table_1.key OPERATOR(pg_catalog.=) 1)) cte_1_1) foo) cte_1 JOIN local_shard_execution.distributed_table_xxxxxxx distributed_table(key, value, age) USING (key)) WHERE ((distributed_table.key OPERATOR(pg_catalog.=) 1) AND (distributed_table.key OPERATOR(pg_catalog.=) ANY (SELECT distributed_table_1.key FROM local_shard_execution.distributed_table_xxxxxxx distributed_table_1 WHERE (distributed_table_1.key OPERATOR(pg_catalog.=) 1)))) count --------------------------------------------------------------------- 0 @@ -2033,7 +2033,7 @@ CREATE TABLE event_responses ( response invite_resp, primary key (event_id, user_id) ); -SELECT create_distributed_table('event_responses', 'event_id'); +SELECT create_distributed_table('event_responses', 'event_id', colocate_with => 'none'); create_distributed_table --------------------------------------------------------------------- @@ -2045,7 +2045,7 @@ CREATE TABLE event_responses_no_pkey ( user_id int, response invite_resp ); -SELECT create_distributed_table('event_responses_no_pkey', 'event_id'); +SELECT create_distributed_table('event_responses_no_pkey', 'event_id', colocate_with => 'event_responses'); create_distributed_table --------------------------------------------------------------------- @@ -3278,11 +3278,36 @@ SELECT pg_sleep(0.1); -- wait to make sure the config has changed before running (1 row) SET citus.enable_local_execution TO false; -- force a connection to the dummy placements +SET citus.enable_single_task_execution TO false; -- use adaptive executor for predictable error messages -- run queries that use dummy placements for local execution -SELECT * FROM event_responses WHERE FALSE; -ERROR: connection to the remote node postgres@foobar:57636 failed with the following error: could not translate host name "foobar" to address: -WITH cte_1 AS (SELECT * FROM event_responses LIMIT 1) SELECT count(*) FROM cte_1; -ERROR: connection to the remote node postgres@foobar:57636 failed with the following error: could not translate host name "foobar" to address: +-- The exact error format depends on DNS resolution timing (pool timeout vs +-- immediate connection failure), so we catch the error and verify it mentions foobar. +DO $$ +BEGIN + PERFORM * FROM event_responses WHERE FALSE; + RAISE NOTICE 'ERROR: should have failed when connecting to foobar'; +EXCEPTION WHEN OTHERS THEN + IF SQLERRM LIKE '%foobar%' THEN + RAISE NOTICE 'correctly attempted connection to foobar'; + ELSE + RAISE NOTICE 'ERROR: unexpected error: %', SQLERRM; + END IF; +END; +$$; +NOTICE: correctly attempted connection to foobar +DO $$ +BEGIN + EXECUTE 'WITH cte_1 AS (SELECT * FROM event_responses LIMIT 1) SELECT count(*) FROM cte_1'; + RAISE NOTICE 'ERROR: should have failed when connecting to foobar'; +EXCEPTION WHEN OTHERS THEN + IF SQLERRM LIKE '%foobar%' THEN + RAISE NOTICE 'correctly attempted connection to foobar'; + ELSE + RAISE NOTICE 'ERROR: unexpected error: %', SQLERRM; + END IF; +END; +$$; +NOTICE: correctly attempted connection to foobar ALTER SYSTEM RESET citus.local_hostname; SELECT pg_reload_conf(); pg_reload_conf diff --git a/src/test/regress/expected/local_shard_execution_replicated.out b/src/test/regress/expected/local_shard_execution_replicated.out index 2ee728b66eb..5dc3c1b4e17 100644 --- a/src/test/regress/expected/local_shard_execution_replicated.out +++ b/src/test/regress/expected/local_shard_execution_replicated.out @@ -703,46 +703,46 @@ NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shar (1 row) SELECT count(*) FROM distributed_table d1 join distributed_table d2 using(age); -NOTICE: executing the command locally: SELECT partition_index, 'repartition_69_1' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_69_1','SELECT age AS column1 FROM local_shard_execution_replicated.distributed_table_1500001 d1 WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true,true,true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartition_69_3' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_69_3','SELECT age AS column1 FROM local_shard_execution_replicated.distributed_table_1500003 d1 WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true,true,true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartition_70_1' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_70_1','SELECT age AS column1 FROM local_shard_execution_replicated.distributed_table_1500001 d2 WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true,true,true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartition_70_3' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_70_3','SELECT age AS column1 FROM local_shard_execution_replicated.distributed_table_1500003 d2 WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true,true,true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_1_0']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_2_0']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_3_0']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_4_0']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_1_0']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_2_0']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_3_0']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_4_0']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_1_1']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_2_1']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_3_1']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_4_1']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_1_1']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_2_1']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_3_1']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_4_1']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_1_2']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_2_2']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_3_2']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_4_2']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_1_2']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_2_2']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_3_2']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_4_2']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_1_3']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_2_3']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_3_3']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_4_3']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_1_3']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_2_3']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_3_3']::text[],'localhost',57637) bytes -NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_4_3']::text[],'localhost',57638) bytes -NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_69_1_0,repartition_69_2_0,repartition_69_3_0,repartition_69_4_0}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 bigint) JOIN read_intermediate_results('{repartition_70_1_0,repartition_70_2_0,repartition_70_3_0,repartition_70_4_0}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 bigint) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true -NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_69_1_1,repartition_69_2_1,repartition_69_3_1,repartition_69_4_1}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 bigint) JOIN read_intermediate_results('{repartition_70_1_1,repartition_70_2_1,repartition_70_3_1,repartition_70_4_1}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 bigint) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true -NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_69_1_2,repartition_69_2_2,repartition_69_3_2,repartition_69_4_2}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 bigint) JOIN read_intermediate_results('{repartition_70_1_2,repartition_70_2_2,repartition_70_3_2,repartition_70_4_2}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 bigint) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true -NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_69_1_3,repartition_69_2_3,repartition_69_3_3,repartition_69_4_3}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 bigint) JOIN read_intermediate_results('{repartition_70_1_3,repartition_70_2_3,repartition_70_3_3,repartition_70_4_3}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 bigint) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true +NOTICE: executing the command locally: SELECT partition_index, 'repartition_69_1' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_69_1','SELECT age AS column1 FROM local_shard_execution_replicated.distributed_table_1500001 d1 WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true,true,true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartition_69_3' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_69_3','SELECT age AS column1 FROM local_shard_execution_replicated.distributed_table_1500003 d1 WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true,true,true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartition_70_1' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_70_1','SELECT age AS column1 FROM local_shard_execution_replicated.distributed_table_1500001 d2 WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true,true,true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartition_70_3' || '_' || partition_index::text , rows_written FROM pg_catalog.worker_partition_query_result('repartition_70_3','SELECT age AS column1 FROM local_shard_execution_replicated.distributed_table_1500003 d2 WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true,true,true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_1_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_2_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_3_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_4_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_1_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_2_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_3_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_4_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_1_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_2_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_3_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_4_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_1_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_2_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_3_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_4_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_1_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_2_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_3_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_4_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_1_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_2_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_3_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_4_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_1_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_2_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_3_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_69_4_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_1_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_2_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_3_N']::text[],'localhost',57637) bytes +NOTICE: executing the command locally: SELECT bytes FROM fetch_intermediate_results(ARRAY['repartition_70_4_N']::text[],'localhost',57638) bytes +NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_69_1_N,repartition_69_2_N,repartition_69_3_N,repartition_69_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 bigint) JOIN read_intermediate_results('{repartition_70_1_N,repartition_70_2_N,repartition_70_3_N,repartition_70_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 bigint) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_69_1_N,repartition_69_2_N,repartition_69_3_N,repartition_69_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 bigint) JOIN read_intermediate_results('{repartition_70_1_N,repartition_70_2_N,repartition_70_3_N,repartition_70_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 bigint) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_69_1_N,repartition_69_2_N,repartition_69_3_N,repartition_69_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 bigint) JOIN read_intermediate_results('{repartition_70_1_N,repartition_70_2_N,repartition_70_3_N,repartition_70_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 bigint) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true +NOTICE: executing the command locally: SELECT count(*) AS count FROM (read_intermediate_results('{repartition_69_1_N,repartition_69_2_N,repartition_69_3_N,repartition_69_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result(column1 bigint) JOIN read_intermediate_results('{repartition_70_1_N,repartition_70_2_N,repartition_70_3_N,repartition_70_4_N}'::text[], 'binary'::citus_copy_format) intermediate_result_1(column1 bigint) ON ((intermediate_result.column1 OPERATOR(pg_catalog.=) intermediate_result_1.column1))) WHERE true count --------------------------------------------------------------------- 2 @@ -765,10 +765,10 @@ NOTICE: executing the command locally: SELECT (OPERATOR(pg_catalog.-) key) AS k NOTICE: executing the command locally: SELECT (OPERATOR(pg_catalog.-) key) AS key FROM local_shard_execution_replicated.distributed_table_1500004 distributed_table WHERE true NOTICE: executing the copy locally for shard xxxxx INSERT INTO distributed_table (key) SELECT -key FROM distributed_table; -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1500001_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1500001_to','SELECT (OPERATOR(pg_catalog.-) key) AS key FROM local_shard_execution_replicated.distributed_table_1500001 distributed_table WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1500002_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1500002_to','SELECT (OPERATOR(pg_catalog.-) key) AS key FROM local_shard_execution_replicated.distributed_table_1500002 distributed_table WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1500003_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1500003_to','SELECT (OPERATOR(pg_catalog.-) key) AS key FROM local_shard_execution_replicated.distributed_table_1500003 distributed_table WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1500004_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1500004_to','SELECT (OPERATOR(pg_catalog.-) key) AS key FROM local_shard_execution_replicated.distributed_table_1500004 distributed_table WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1500001_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1500001_to','SELECT (OPERATOR(pg_catalog.-) key) AS key FROM local_shard_execution_replicated.distributed_table_1500001 distributed_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1500002_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1500002_to','SELECT (OPERATOR(pg_catalog.-) key) AS key FROM local_shard_execution_replicated.distributed_table_1500002 distributed_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1500003_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1500003_to','SELECT (OPERATOR(pg_catalog.-) key) AS key FROM local_shard_execution_replicated.distributed_table_1500003 distributed_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_1500004_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_1500004_to','SELECT (OPERATOR(pg_catalog.-) key) AS key FROM local_shard_execution_replicated.distributed_table_1500004 distributed_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 NOTICE: executing the command locally: INSERT INTO local_shard_execution_replicated.distributed_table_1500001 AS citus_table_alias (key) SELECT intermediate_result.key FROM read_intermediate_results('{repartitioned_results_xxxxx_from_1500003_to_0}'::text[], 'binary'::citus_copy_format) intermediate_result(key integer) NOTICE: executing the command locally: INSERT INTO local_shard_execution_replicated.distributed_table_1500004 AS citus_table_alias (key) SELECT intermediate_result.key FROM read_intermediate_results('{repartitioned_results_xxxxx_from_1500004_to_3}'::text[], 'binary'::citus_copy_format) intermediate_result(key integer) SELECT count(*) FROM distributed_table WHERE key = -6; diff --git a/src/test/regress/expected/multi_data_types.out b/src/test/regress/expected/multi_data_types.out index 7b6a367ee1a..e6509bd2159 100644 --- a/src/test/regress/expected/multi_data_types.out +++ b/src/test/regress/expected/multi_data_types.out @@ -172,9 +172,9 @@ SELECT * FROM composite_type_partitioned_table WHERE id = 123; EXPLAIN (ANALYZE TRUE, COSTS FALSE, VERBOSE FALSE, TIMING FALSE, SUMMARY FALSE, BUFFERS OFF) INSERT INTO composite_type_partitioned_table VALUES (123, '(123, 456)'::other_composite_type); - QUERY PLAN + QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) (actual rows=0 loops=1) + Custom Scan (Citus Single Task) (actual rows=0 loops=1) Task Count: 1 Tasks Shown: All -> Task @@ -214,9 +214,9 @@ $cf$); INSERT INTO composite_type_partitioned_table VALUES (456, '(456, 678)'::other_composite_type); EXPLAIN (ANALYZE TRUE, COSTS FALSE, VERBOSE FALSE, TIMING FALSE, SUMMARY FALSE, BUFFERS OFF) INSERT INTO composite_type_partitioned_table VALUES (123, '(456, 678)'::other_composite_type); - QUERY PLAN + QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) (actual rows=0 loops=1) + Custom Scan (Citus Single Task) (actual rows=0 loops=1) Task Count: 1 Tasks Shown: All -> Task diff --git a/src/test/regress/expected/multi_explain.out b/src/test/regress/expected/multi_explain.out index 40e99b59821..598e79889a4 100644 --- a/src/test/regress/expected/multi_explain.out +++ b/src/test/regress/expected/multi_explain.out @@ -1384,7 +1384,7 @@ Aggregate -- at least make sure to fail without crashing PREPARE router_executor_query_param(int) AS SELECT l_quantity FROM lineitem WHERE l_orderkey = $1; EXPLAIN EXECUTE router_executor_query_param(5); -Custom Scan (Citus Adaptive) (cost=0.00..0.00 rows=0 width=0) +Custom Scan (Citus Single Task) (cost=0.00..0.00 rows=0 width=0) Task Count: 1 Tasks Shown: All -> Task @@ -1392,7 +1392,7 @@ Custom Scan (Citus Adaptive) (cost=0.00..0.00 rows=0 width=0) -> Index Scan using lineitem_pkey_360000 on lineitem_360000 lineitem (cost=0.28..13.60 rows=4 width=5) Index Cond: (l_orderkey = 5) select public.explain_filter('EXPLAIN (ANALYZE ON, COSTS OFF, TIMING OFF, SUMMARY OFF, BUFFERS OFF) EXECUTE router_executor_query_param(5)'); -Custom Scan (Citus Adaptive) (actual rows=N loops=N) +Custom Scan (Citus Single Task) (actual rows=N loops=N) Task Count: N Tuple data received from nodes: N bytes Tasks Shown: All @@ -2611,7 +2611,7 @@ Custom Scan (Citus Adaptive) (actual rows=6 loops=1) -> Seq Scan on dist_table_rep1_570022 dist_table_rep1 (actual rows=4 loops=1) prepare p2 AS SELECT * FROM dist_table_rep1 WHERE a = $1; EXPLAIN :default_analyze_flags EXECUTE p2(1); -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2622,7 +2622,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p2(1); -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2633,7 +2633,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p2(1); -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2644,7 +2644,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p2(1); -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2655,7 +2655,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p2(1); -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2666,7 +2666,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p2(1); -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2677,7 +2677,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p2(10); -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2688,7 +2688,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 10) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p2(100); -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2700,7 +2700,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Rows Removed by Filter: 1 prepare p3 AS SELECT * FROM dist_table_rep1 WHERE a = 1; EXPLAIN :default_analyze_flags EXECUTE p3; -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2711,7 +2711,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p3; -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2722,7 +2722,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p3; -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2733,7 +2733,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p3; -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2744,7 +2744,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p3; -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2755,7 +2755,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p3; -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All diff --git a/src/test/regress/expected/multi_explain_0.out b/src/test/regress/expected/multi_explain_0.out index 85a7034f002..196aa6b9b57 100644 --- a/src/test/regress/expected/multi_explain_0.out +++ b/src/test/regress/expected/multi_explain_0.out @@ -1377,7 +1377,7 @@ Aggregate -- at least make sure to fail without crashing PREPARE router_executor_query_param(int) AS SELECT l_quantity FROM lineitem WHERE l_orderkey = $1; EXPLAIN EXECUTE router_executor_query_param(5); -Custom Scan (Citus Adaptive) (cost=0.00..0.00 rows=0 width=0) +Custom Scan (Citus Single Task) (cost=0.00..0.00 rows=0 width=0) Task Count: 1 Tasks Shown: All -> Task @@ -1385,7 +1385,7 @@ Custom Scan (Citus Adaptive) (cost=0.00..0.00 rows=0 width=0) -> Index Scan using lineitem_pkey_360000 on lineitem_360000 lineitem (cost=0.28..13.60 rows=4 width=5) Index Cond: (l_orderkey = 5) select public.explain_filter('EXPLAIN (ANALYZE ON, COSTS OFF, TIMING OFF, SUMMARY OFF, BUFFERS OFF) EXECUTE router_executor_query_param(5)'); -Custom Scan (Citus Adaptive) (actual rows=N loops=N) +Custom Scan (Citus Single Task) (actual rows=N loops=N) Task Count: N Tuple data received from nodes: N bytes Tasks Shown: All @@ -2603,7 +2603,7 @@ Custom Scan (Citus Adaptive) (actual rows=6 loops=1) -> Seq Scan on dist_table_rep1_570022 dist_table_rep1 (actual rows=4 loops=1) prepare p2 AS SELECT * FROM dist_table_rep1 WHERE a = $1; EXPLAIN :default_analyze_flags EXECUTE p2(1); -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2614,7 +2614,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p2(1); -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2625,7 +2625,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p2(1); -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2636,7 +2636,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p2(1); -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2647,7 +2647,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p2(1); -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2658,7 +2658,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p2(1); -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2669,7 +2669,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p2(10); -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2680,7 +2680,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 10) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p2(100); -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2692,7 +2692,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Rows Removed by Filter: 1 prepare p3 AS SELECT * FROM dist_table_rep1 WHERE a = 1; EXPLAIN :default_analyze_flags EXECUTE p3; -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2703,7 +2703,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p3; -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2714,7 +2714,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p3; -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2725,7 +2725,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p3; -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2736,7 +2736,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p3; -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All @@ -2747,7 +2747,7 @@ Custom Scan (Citus Adaptive) (actual rows=1 loops=1) Filter: (a = 1) Rows Removed by Filter: 3 EXPLAIN :default_analyze_flags EXECUTE p3; -Custom Scan (Citus Adaptive) (actual rows=1 loops=1) +Custom Scan (Citus Single Task) (actual rows=1 loops=1) Task Count: 1 Tuple data received from nodes: 4 bytes Tasks Shown: All diff --git a/src/test/regress/expected/multi_mx_explain.out b/src/test/regress/expected/multi_mx_explain.out index 7f53ef1c4ef..b880a03fa0a 100644 --- a/src/test/regress/expected/multi_mx_explain.out +++ b/src/test/regress/expected/multi_mx_explain.out @@ -343,7 +343,7 @@ Limit -- Test insert EXPLAIN (COSTS FALSE) INSERT INTO lineitem_mx VALUES(1,0); -Custom Scan (Citus Adaptive) +Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task @@ -355,7 +355,7 @@ EXPLAIN (COSTS FALSE) UPDATE lineitem_mx SET l_suppkey = 12 WHERE l_orderkey = 1 AND l_partkey = 0; -Custom Scan (Citus Adaptive) +Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task @@ -368,7 +368,7 @@ Custom Scan (Citus Adaptive) EXPLAIN (COSTS FALSE) DELETE FROM lineitem_mx WHERE l_orderkey = 1 AND l_partkey = 0; -Custom Scan (Citus Adaptive) +Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task @@ -385,7 +385,7 @@ VACUUM ANALYZE supplier_mx; -- Test single-shard SELECT EXPLAIN (COSTS FALSE) SELECT l_quantity FROM lineitem_mx WHERE l_orderkey = 5; -Custom Scan (Citus Adaptive) +Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task diff --git a/src/test/regress/expected/multi_mx_explain_0.out b/src/test/regress/expected/multi_mx_explain_0.out index 934954720bd..faf35cc1a69 100644 --- a/src/test/regress/expected/multi_mx_explain_0.out +++ b/src/test/regress/expected/multi_mx_explain_0.out @@ -338,7 +338,7 @@ Limit -- Test insert EXPLAIN (COSTS FALSE) INSERT INTO lineitem_mx VALUES(1,0); -Custom Scan (Citus Adaptive) +Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task @@ -350,7 +350,7 @@ EXPLAIN (COSTS FALSE) UPDATE lineitem_mx SET l_suppkey = 12 WHERE l_orderkey = 1 AND l_partkey = 0; -Custom Scan (Citus Adaptive) +Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task @@ -363,7 +363,7 @@ Custom Scan (Citus Adaptive) EXPLAIN (COSTS FALSE) DELETE FROM lineitem_mx WHERE l_orderkey = 1 AND l_partkey = 0; -Custom Scan (Citus Adaptive) +Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task @@ -380,7 +380,7 @@ VACUUM ANALYZE supplier_mx; -- Test single-shard SELECT EXPLAIN (COSTS FALSE) SELECT l_quantity FROM lineitem_mx WHERE l_orderkey = 5; -Custom Scan (Citus Adaptive) +Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task diff --git a/src/test/regress/expected/multi_mx_insert_select_repartition.out b/src/test/regress/expected/multi_mx_insert_select_repartition.out index 0113239ead3..6ffba582f51 100644 --- a/src/test/regress/expected/multi_mx_insert_select_repartition.out +++ b/src/test/regress/expected/multi_mx_insert_select_repartition.out @@ -95,8 +95,8 @@ NOTICE: executing the command locally: SELECT count(*) AS count FROM multi_mx_i -- we omit the "SELECT bytes FROM fetch_intermediate_results..." line since it is flaky SET LOCAL citus.grep_remote_commands TO '%multi_mx_insert_select_repartition%'; insert into target_table SELECT a*2 FROM source_table RETURNING a; -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_4213581_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_4213581_to','SELECT (a OPERATOR(pg_catalog.*) 2) AS a FROM multi_mx_insert_select_repartition.source_table_4213581 source_table WHERE true',0,'hash','{-2147483648,-715827883,715827882}'::text[],'{-715827884,715827881,2147483647}'::text[],true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_4213583_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_4213583_to','SELECT (a OPERATOR(pg_catalog.*) 2) AS a FROM multi_mx_insert_select_repartition.source_table_4213583 source_table WHERE true',0,'hash','{-2147483648,-715827883,715827882}'::text[],'{-715827884,715827881,2147483647}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_4213581_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_4213581_to','SELECT (a OPERATOR(pg_catalog.*) 2) AS a FROM multi_mx_insert_select_repartition.source_table_4213581 source_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_4213583_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_4213583_to','SELECT (a OPERATOR(pg_catalog.*) 2) AS a FROM multi_mx_insert_select_repartition.source_table_4213583 source_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 NOTICE: executing the command locally: INSERT INTO multi_mx_insert_select_repartition.target_table_4213585 AS citus_table_alias (a) SELECT intermediate_result.a FROM read_intermediate_results('{repartitioned_results_xxxxx_from_4213581_to_0,repartitioned_results_xxxxx_from_4213582_to_0,repartitioned_results_xxxxx_from_4213584_to_0}'::text[], 'binary'::citus_copy_format) intermediate_result(a integer) RETURNING citus_table_alias.a NOTICE: executing the command locally: INSERT INTO multi_mx_insert_select_repartition.target_table_4213587 AS citus_table_alias (a) SELECT intermediate_result.a FROM read_intermediate_results('{repartitioned_results_xxxxx_from_4213581_to_2}'::text[], 'binary'::citus_copy_format) intermediate_result(a integer) RETURNING citus_table_alias.a a diff --git a/src/test/regress/expected/multi_router_planner_fast_path.out b/src/test/regress/expected/multi_router_planner_fast_path.out index 6dd9de3a98e..a7e81b4a52f 100644 --- a/src/test/regress/expected/multi_router_planner_fast_path.out +++ b/src/test/regress/expected/multi_router_planner_fast_path.out @@ -1395,6 +1395,8 @@ DEBUG: query has a single distribution column value: 1 (1 row) -- prepare queries can be router plannable +-- force custom plan to avoid flaky DEBUG output from generic plan transition +SET plan_cache_mode TO force_custom_plan; PREPARE author_1_articles as SELECT * FROM articles_hash @@ -1462,7 +1464,10 @@ EXECUTE author_1_articles; 41 | 1 | aznavour | 11814 (5 rows) +RESET plan_cache_mode; -- parametric prepare queries can be router plannable +-- force custom plan to avoid flaky DEBUG output from generic plan transition +SET plan_cache_mode TO force_custom_plan; PREPARE author_articles(int) as SELECT * FROM articles_hash @@ -1540,36 +1545,50 @@ DEBUG: Creating router plan (5 rows) EXECUTE author_articles(NULL); +DEBUG: Deferred pruning for a fast-path router query +DEBUG: Creating router plan id | author_id | title | word_count --------------------------------------------------------------------- (0 rows) EXECUTE author_articles(NULL); +DEBUG: Deferred pruning for a fast-path router query +DEBUG: Creating router plan id | author_id | title | word_count --------------------------------------------------------------------- (0 rows) EXECUTE author_articles(NULL); +DEBUG: Deferred pruning for a fast-path router query +DEBUG: Creating router plan id | author_id | title | word_count --------------------------------------------------------------------- (0 rows) EXECUTE author_articles(NULL); +DEBUG: Deferred pruning for a fast-path router query +DEBUG: Creating router plan id | author_id | title | word_count --------------------------------------------------------------------- (0 rows) EXECUTE author_articles(NULL); +DEBUG: Deferred pruning for a fast-path router query +DEBUG: Creating router plan id | author_id | title | word_count --------------------------------------------------------------------- (0 rows) EXECUTE author_articles(NULL); +DEBUG: Deferred pruning for a fast-path router query +DEBUG: Creating router plan id | author_id | title | word_count --------------------------------------------------------------------- (0 rows) EXECUTE author_articles(NULL); +DEBUG: Deferred pruning for a fast-path router query +DEBUG: Creating router plan id | author_id | title | word_count --------------------------------------------------------------------- (0 rows) @@ -1595,6 +1614,9 @@ EXECUTE author_articles_update(NULL); DEBUG: Deferred pruning for a fast-path router query DEBUG: Creating router plan EXECUTE author_articles_update(NULL); +DEBUG: Deferred pruning for a fast-path router query +DEBUG: Creating router plan +RESET plan_cache_mode; -- queries inside plpgsql functions could be router plannable CREATE OR REPLACE FUNCTION author_articles_max_id() RETURNS int AS $$ DECLARE diff --git a/src/test/regress/expected/multi_tenant_isolation.out b/src/test/regress/expected/multi_tenant_isolation.out index 991f09d0fae..1df55f71321 100644 --- a/src/test/regress/expected/multi_tenant_isolation.out +++ b/src/test/regress/expected/multi_tenant_isolation.out @@ -202,7 +202,7 @@ SELECT isolate_tenant_to_new_shard('lineitem_streaming', 101, 'CASCADE', shard_t EXPLAIN (COSTS false) SELECT count(*) FROM lineitem_streaming WHERE l_orderkey = 101; QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) + Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task diff --git a/src/test/regress/expected/multi_tenant_isolation_nonblocking.out b/src/test/regress/expected/multi_tenant_isolation_nonblocking.out index 0d4ecb1ebcf..33c4792d31b 100644 --- a/src/test/regress/expected/multi_tenant_isolation_nonblocking.out +++ b/src/test/regress/expected/multi_tenant_isolation_nonblocking.out @@ -202,7 +202,7 @@ SELECT isolate_tenant_to_new_shard('lineitem_streaming', 101, 'CASCADE', shard_t EXPLAIN (COSTS false) SELECT count(*) FROM lineitem_streaming WHERE l_orderkey = 101; QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) + Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task diff --git a/src/test/regress/expected/multi_transaction_recovery.out b/src/test/regress/expected/multi_transaction_recovery.out index 85144944d18..26e13080062 100644 --- a/src/test/regress/expected/multi_transaction_recovery.out +++ b/src/test/regress/expected/multi_transaction_recovery.out @@ -11,15 +11,20 @@ SELECT pg_reload_conf(); t (1 row) --- Ensure pg_dist_transaction is empty +-- Ensure pg_dist_transaction is empty for a clean start SELECT recover_prepared_transactions(); recover_prepared_transactions --------------------------------------------------------------------- 0 (1 row) +DELETE FROM pg_dist_transaction; -- Create some "fake" prepared transactions to recover +-- Clean up any leftover tables from previous runs \c - - - :worker_1_port +SET client_min_messages TO WARNING; +DROP TABLE IF EXISTS should_abort, should_commit, should_be_sorted_into_middle; +RESET client_min_messages; BEGIN; CREATE TABLE should_abort (value int); PREPARE TRANSACTION 'citus_0_should_abort'; @@ -30,6 +35,9 @@ BEGIN; CREATE TABLE should_be_sorted_into_middle (value int); PREPARE TRANSACTION 'citus_0_should_be_sorted_into_middle'; \c - - - :master_port +SET client_min_messages TO WARNING; +DROP TABLE IF EXISTS should_abort, should_commit, should_be_sorted_into_middle; +RESET client_min_messages; BEGIN; CREATE TABLE should_abort (value int); PREPARE TRANSACTION 'citus_0_should_abort'; @@ -41,10 +49,13 @@ CREATE TABLE should_be_sorted_into_middle (value int); PREPARE TRANSACTION 'citus_0_should_be_sorted_into_middle'; SET citus.force_max_query_parallelization TO ON; -- Add "fake" pg_dist_transaction records and run recovery -INSERT INTO pg_dist_transaction VALUES (1, 'citus_0_should_commit'), - (0, 'citus_0_should_commit'); -INSERT INTO pg_dist_transaction VALUES (1, 'citus_0_should_be_forgotten'), - (0, 'citus_0_should_be_forgotten'); +-- Use dynamic group IDs so this works regardless of which cluster setup ran +INSERT INTO pg_dist_transaction + VALUES ((SELECT groupid FROM pg_dist_node WHERE nodeport = :worker_1_port AND nodecluster = 'default' LIMIT 1), 'citus_0_should_commit'), + (0, 'citus_0_should_commit'); +INSERT INTO pg_dist_transaction + VALUES ((SELECT groupid FROM pg_dist_node WHERE nodeport = :worker_1_port AND nodecluster = 'default' LIMIT 1), 'citus_0_should_be_forgotten'), + (0, 'citus_0_should_be_forgotten'); SELECT recover_prepared_transactions(); recover_prepared_transactions --------------------------------------------------------------------- @@ -222,6 +233,7 @@ SELECT recover_prepared_transactions(); -- Create a single-replica table to enable 2PC in multi-statement transactions SET citus.shard_replication_factor TO 1; +SET citus.enable_single_task_execution TO false; -- use adaptive executor for predictable 2PC behavior CREATE TABLE test_recovery_single (LIKE test_recovery); -- creating distributed table should write 2 transaction recovery records -- one connection/transaction per node @@ -341,6 +353,9 @@ SELECT recover_prepared_transactions(); 0 (1 row) +SET client_min_messages TO WARNING; +DROP TABLE IF EXISTS selected_shard; +RESET client_min_messages; SELECT shardid INTO selected_shard FROM citus_shards WHERE table_name='test_2pcskip'::regclass AND nodeport = :worker_1_port @@ -505,3 +520,7 @@ DROP TABLE test_recovery; DROP TABLE test_recovery_single; DROP TABLE test_2pcskip; DROP TABLE test_reference; +SET client_min_messages TO WARNING; +DROP TABLE IF EXISTS selected_shard; +DROP TABLE IF EXISTS should_abort, should_commit, should_be_sorted_into_middle; +RESET client_min_messages; diff --git a/src/test/regress/expected/pg13.out b/src/test/regress/expected/pg13.out index 2e1816a6b3f..02625b5a914 100644 --- a/src/test/regress/expected/pg13.out +++ b/src/test/regress/expected/pg13.out @@ -175,7 +175,7 @@ ERROR: EXPLAIN option WAL requires ANALYZE -- test WAL working properly for router queries EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE, BUFFERS OFF) INSERT INTO test_wal VALUES(1,11); - QUERY PLAN + QUERY PLAN --------------------------------------------------------------------- Insert on test_wal (actual rows=0 loops=1) WAL: records=1 bytes=63 @@ -194,9 +194,9 @@ HINT: To remove the local data, run: SELECT truncate_local_data_after_distribut EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE, BUFFERS OFF) INSERT INTO test_wal VALUES(2,22); - QUERY PLAN + QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) (actual rows=0 loops=1) + Custom Scan (Citus Single Task) (actual rows=0 loops=1) Task Count: 1 Tasks Shown: All -> Task @@ -210,7 +210,7 @@ INSERT INTO test_wal VALUES(2,22); SET citus.explain_all_tasks TO on; EXPLAIN (ANALYZE TRUE, WAL TRUE, COSTS FALSE, SUMMARY FALSE, BUFFERS FALSE, TIMING FALSE, BUFFERS OFF) INSERT INTO test_wal VALUES(3,33),(4,44),(5,55) RETURNING *; - QUERY PLAN + QUERY PLAN --------------------------------------------------------------------- Custom Scan (Citus Adaptive) (actual rows=3 loops=1) Task Count: 1 diff --git a/src/test/regress/expected/pg15.out b/src/test/regress/expected/pg15.out index 66299af08d4..362bf2bec97 100644 --- a/src/test/regress/expected/pg15.out +++ b/src/test/regress/expected/pg15.out @@ -1371,7 +1371,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM foreign_table WHERE c1 = 'foo' LIMIT 1; QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) + Custom Scan (Citus Single Task) Output: remote_scan.c0, remote_scan.c1 Task Count: 1 Tasks Shown: All @@ -1394,7 +1394,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM foreign_table WHERE 'foo' = c1 LIMIT 1; QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) + Custom Scan (Citus Single Task) Output: remote_scan.c0, remote_scan.c1 Task Count: 1 Tasks Shown: All diff --git a/src/test/regress/expected/pg18.out b/src/test/regress/expected/pg18.out index 861c12f4946..19e006b941c 100644 --- a/src/test/regress/expected/pg18.out +++ b/src/test/regress/expected/pg18.out @@ -891,7 +891,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ctl_ft1 ORDER BY a; QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) + Custom Scan (Citus Single Task) Output: remote_scan.a, remote_scan.b, remote_scan.c, remote_scan.d, remote_scan.e Task Count: 1 Tasks Shown: All @@ -916,7 +916,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ctl_ft2 ORDER BY a; QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) + Custom Scan (Citus Single Task) Output: remote_scan.a, remote_scan.b, remote_scan.c, remote_scan.d, remote_scan.e Task Count: 1 Tasks Shown: All @@ -3014,10 +3014,10 @@ SET citus.explain_all_tasks TO default; -- and new function pg_get_loaded_modules -- Relevant PG18 commit: https://github.com/postgres/postgres/commit/9324c8c58 SELECT * FROM pg_get_loaded_modules() WHERE file_name LIKE 'citus%' ORDER BY module_name; - module_name | version | file_name + module_name | version | file_name --------------------------------------------------------------------- - citus | 15.0devel | citus.so - citus_columnar | 15.0devel | citus_columnar.so + citus | 15.0devel | citus.so + citus_columnar | 15.0devel | citus_columnar.so (2 rows) -- ============================================================ diff --git a/src/test/regress/expected/single_node.out b/src/test/regress/expected/single_node.out index bdd89459875..fdfe960f211 100644 --- a/src/test/regress/expected/single_node.out +++ b/src/test/regress/expected/single_node.out @@ -2222,10 +2222,10 @@ NOTICE: executing the command locally: INSERT INTO single_node.another_schema_t NOTICE: executing the command locally: INSERT INTO single_node.another_schema_table_90630517 AS citus_table_alias (a, b) SELECT another_schema_table.a, another_schema_table.b FROM single_node.another_schema_table_90630517 another_schema_table WHERE (another_schema_table.a IS NOT NULL) NOTICE: executing the command locally: INSERT INTO single_node.another_schema_table_90630518 AS citus_table_alias (a, b) SELECT another_schema_table.a, another_schema_table.b FROM single_node.another_schema_table_90630518 another_schema_table WHERE (another_schema_table.a IS NOT NULL) INSERT INTO another_schema_table SELECT b::int, a::int FROM another_schema_table; -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_90630515_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_90630515_to','SELECT b AS a, a AS b FROM single_node.another_schema_table_90630515 another_schema_table WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_90630516_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_90630516_to','SELECT b AS a, a AS b FROM single_node.another_schema_table_90630516 another_schema_table WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_90630517_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_90630517_to','SELECT b AS a, a AS b FROM single_node.another_schema_table_90630517 another_schema_table WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_90630518_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_90630518_to','SELECT b AS a, a AS b FROM single_node.another_schema_table_90630518 another_schema_table WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_90630515_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_90630515_to','SELECT b AS a, a AS b FROM single_node.another_schema_table_90630515 another_schema_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_90630516_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_90630516_to','SELECT b AS a, a AS b FROM single_node.another_schema_table_90630516 another_schema_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_90630517_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_90630517_to','SELECT b AS a, a AS b FROM single_node.another_schema_table_90630517 another_schema_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_90630518_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_90630518_to','SELECT b AS a, a AS b FROM single_node.another_schema_table_90630518 another_schema_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 -- multi-row INSERTs INSERT INTO another_schema_table VALUES (1,1), (2,2), (3,3), (4,4), (5,5),(6,6),(7,7); NOTICE: executing the command locally: INSERT INTO single_node.another_schema_table_90630515 AS citus_table_alias (a, b) VALUES (1,1), (5,5) @@ -2239,10 +2239,10 @@ NOTICE: executing the command locally: INSERT INTO single_node.another_schema_t INSERT INTO another_schema_table VALUES (2,100); NOTICE: executing the command locally: INSERT INTO single_node.another_schema_table_90630518 (a, b) VALUES (2, 100) INSERT INTO another_schema_table SELECT b::int, a::int FROM another_schema_table; -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_90630515_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_90630515_to','SELECT b AS a, a AS b FROM single_node.another_schema_table_90630515 another_schema_table WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_90630516_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_90630516_to','SELECT b AS a, a AS b FROM single_node.another_schema_table_90630516 another_schema_table WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_90630517_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_90630517_to','SELECT b AS a, a AS b FROM single_node.another_schema_table_90630517 another_schema_table WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true) WHERE rows_written > 0 -NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_90630518_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_90630518_to','SELECT b AS a, a AS b FROM single_node.another_schema_table_90630518 another_schema_table WHERE true',0,'hash','{-2147483648,-1073741824,0,1073741824}'::text[],'{-1073741825,-1,1073741823,2147483647}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_90630515_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_90630515_to','SELECT b AS a, a AS b FROM single_node.another_schema_table_90630515 another_schema_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_90630516_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_90630516_to','SELECT b AS a, a AS b FROM single_node.another_schema_table_90630516 another_schema_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_90630517_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_90630517_to','SELECT b AS a, a AS b FROM single_node.another_schema_table_90630517 another_schema_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 +NOTICE: executing the command locally: SELECT partition_index, 'repartitioned_results_xxxxx_from_90630518_to' || '_' || partition_index::text , rows_written FROM worker_partition_query_result('repartitioned_results_xxxxx_from_90630518_to','SELECT b AS a, a AS b FROM single_node.another_schema_table_90630518 another_schema_table WHERE true',0,'hash','{...}'::text[],'{...}'::text[],true) WHERE rows_written > 0 NOTICE: executing the command locally: INSERT INTO single_node.another_schema_table_90630515 AS citus_table_alias (a, b) SELECT intermediate_result.a, intermediate_result.b FROM read_intermediate_results('{repartitioned_results_xxxxx_from_90630515_to_0}'::text[], 'binary'::citus_copy_format) intermediate_result(a integer, b integer) NOTICE: executing the command locally: INSERT INTO single_node.another_schema_table_90630516 AS citus_table_alias (a, b) SELECT intermediate_result.a, intermediate_result.b FROM read_intermediate_results('{repartitioned_results_xxxxx_from_90630516_to_1}'::text[], 'binary'::citus_copy_format) intermediate_result(a integer, b integer) NOTICE: executing the command locally: INSERT INTO single_node.another_schema_table_90630517 AS citus_table_alias (a, b) SELECT intermediate_result.a, intermediate_result.b FROM read_intermediate_results('{repartitioned_results_xxxxx_from_90630515_to_2,repartitioned_results_xxxxx_from_90630517_to_2,repartitioned_results_xxxxx_from_90630518_to_2}'::text[], 'binary'::citus_copy_format) intermediate_result(a integer, b integer) diff --git a/src/test/regress/expected/single_task_execution.out b/src/test/regress/expected/single_task_execution.out new file mode 100644 index 00000000000..c9be777c1a7 --- /dev/null +++ b/src/test/regress/expected/single_task_execution.out @@ -0,0 +1,400 @@ +-- +-- SINGLE_TASK_EXECUTION +-- +-- Validates the single-task (one-task) adaptive executor: +-- 1. Produces identical results to the full adaptive executor +-- 2. Shows "Citus Single Task" in EXPLAIN plans +-- 3. Handles single-row and multi-row results +-- 4. Covers simple and complex fast-path queries +-- +CREATE SCHEMA single_task_execution; +SET search_path TO single_task_execution; +SET citus.next_shard_id TO 99900000; +SET citus.shard_count TO 4; +SET citus.shard_replication_factor TO 1; +-- Create test tables +CREATE TABLE kv (key int PRIMARY KEY, value text, num int); +SELECT create_distributed_table('kv', 'key'); + create_distributed_table +--------------------------------------------------------------------- + +(1 row) + +CREATE TABLE kv_multi (key int, seq int, payload text, PRIMARY KEY (key, seq)); +SELECT create_distributed_table('kv_multi', 'key'); + create_distributed_table +--------------------------------------------------------------------- + +(1 row) + +-- Load test data: single-row per key in kv, multiple rows per key in kv_multi +INSERT INTO kv SELECT g, 'val_' || g, g * 10 FROM generate_series(1, 100) g; +INSERT INTO kv_multi SELECT g / 10, g, repeat('x', g % 50 + 1) FROM generate_series(1, 200) g; +-- ============================================================ +-- PART 1: EXPLAIN validation - confirm plan uses Single Task executor +-- ============================================================ +-- Simple point SELECT +EXPLAIN (COSTS OFF) SELECT * FROM kv WHERE key = 1; + QUERY PLAN +--------------------------------------------------------------------- + Custom Scan (Citus Single Task) + Task Count: 1 + Tasks Shown: All + -> Task + Node: host=localhost port=xxxxx dbname=regression + -> Index Scan using kv_pkey_99900000 on kv_99900000 kv + Index Cond: (key = 1) +(7 rows) + +-- Point UPDATE +EXPLAIN (COSTS OFF) UPDATE kv SET value = 'updated' WHERE key = 1; + QUERY PLAN +--------------------------------------------------------------------- + Custom Scan (Citus Single Task) + Task Count: 1 + Tasks Shown: All + -> Task + Node: host=localhost port=xxxxx dbname=regression + -> Update on kv_99900000 kv + -> Index Scan using kv_pkey_99900000 on kv_99900000 kv + Index Cond: (key = 1) +(8 rows) + +-- Point DELETE +EXPLAIN (COSTS OFF) DELETE FROM kv WHERE key = 1; + QUERY PLAN +--------------------------------------------------------------------- + Custom Scan (Citus Single Task) + Task Count: 1 + Tasks Shown: All + -> Task + Node: host=localhost port=xxxxx dbname=regression + -> Delete on kv_99900000 kv + -> Index Scan using kv_pkey_99900000 on kv_99900000 kv + Index Cond: (key = 1) +(8 rows) + +-- INSERT with ON CONFLICT +EXPLAIN (COSTS OFF) INSERT INTO kv (key, value, num) VALUES (1, 'x', 0) + ON CONFLICT (key) DO UPDATE SET num = kv.num + 1; + QUERY PLAN +--------------------------------------------------------------------- + Custom Scan (Citus Single Task) + Task Count: 1 + Tasks Shown: All + -> Task + Node: host=localhost port=xxxxx dbname=regression + -> Insert on kv_99900000 citus_table_alias + Conflict Resolution: UPDATE + Conflict Arbiter Indexes: kv_pkey_99900000 + -> Result +(9 rows) + +-- SELECT with expression in target list +EXPLAIN (COSTS OFF) SELECT key, upper(value), num * 2 AS doubled FROM kv WHERE key = 42; + QUERY PLAN +--------------------------------------------------------------------- + Custom Scan (Citus Single Task) + Task Count: 1 + Tasks Shown: All + -> Task + Node: host=localhost port=xxxxx dbname=regression + -> Index Scan using kv_pkey_99900003 on kv_99900003 kv + Index Cond: (key = 42) +(7 rows) + +-- SELECT with LIMIT (still single-shard, should use single-task) +EXPLAIN (COSTS OFF) SELECT * FROM kv WHERE key = 5 LIMIT 1; + QUERY PLAN +--------------------------------------------------------------------- + Custom Scan (Citus Single Task) + Task Count: 1 + Tasks Shown: All + -> Task + Node: host=localhost port=xxxxx dbname=regression + -> Limit + -> Index Scan using kv_pkey_99900000 on kv_99900000 kv + Index Cond: (key = 5) +(8 rows) + +-- Multi-row per shard key: point lookup with multiple results +EXPLAIN (COSTS OFF) SELECT * FROM kv_multi WHERE key = 5 ORDER BY seq; + QUERY PLAN +--------------------------------------------------------------------- + Custom Scan (Citus Single Task) + Task Count: 1 + Tasks Shown: All + -> Task + Node: host=localhost port=xxxxx dbname=regression + -> Sort + Sort Key: seq + -> Bitmap Heap Scan on kv_multi_99900004 kv_multi + Recheck Cond: (key = 5) + -> Bitmap Index Scan on kv_multi_pkey_99900004 + Index Cond: (key = 5) +(11 rows) + +-- ============================================================ +-- PART 2: Results equivalence - ON vs OFF must produce same results +-- ============================================================ +-- Run queries with single-task ON and capture results +SET citus.enable_single_task_execution TO on; +-- Single-row point lookups +SELECT * FROM kv WHERE key = 1; + key | value | num +--------------------------------------------------------------------- + 1 | val_1 | 10 +(1 row) + +SELECT * FROM kv WHERE key = 50; + key | value | num +--------------------------------------------------------------------- + 50 | val_50 | 500 +(1 row) + +SELECT * FROM kv WHERE key = 99; + key | value | num +--------------------------------------------------------------------- + 99 | val_99 | 990 +(1 row) + +-- Point lookup with expressions +SELECT key, upper(value) AS uval, num + 100 AS shifted FROM kv WHERE key = 42; + key | uval | shifted +--------------------------------------------------------------------- + 42 | VAL_42 | 520 +(1 row) + +-- Multi-row: all rows for a shard key value +SELECT * FROM kv_multi WHERE key = 5 ORDER BY seq; + key | seq | payload +--------------------------------------------------------------------- + 5 | 50 | x + 5 | 51 | xx + 5 | 52 | xxx + 5 | 53 | xxxx + 5 | 54 | xxxxx + 5 | 55 | xxxxxx + 5 | 56 | xxxxxxx + 5 | 57 | xxxxxxxx + 5 | 58 | xxxxxxxxx + 5 | 59 | xxxxxxxxxx +(10 rows) + +-- Multi-row with aggregate +SELECT key, count(*), max(length(payload)) FROM kv_multi WHERE key = 10 GROUP BY key; + key | count | max +--------------------------------------------------------------------- + 10 | 10 | 10 +(1 row) + +-- UPDATE RETURNING +UPDATE kv SET num = num + 1 WHERE key = 7 RETURNING key, num; + key | num +--------------------------------------------------------------------- + 7 | 71 +(1 row) + +-- INSERT ON CONFLICT RETURNING +INSERT INTO kv (key, value, num) VALUES (7, 'conflict', 999) + ON CONFLICT (key) DO UPDATE SET num = kv.num + 1 + RETURNING key, value, num; + key | value | num +--------------------------------------------------------------------- + 7 | val_7 | 72 +(1 row) + +-- DELETE RETURNING +DELETE FROM kv WHERE key = 100 RETURNING *; + key | value | num +--------------------------------------------------------------------- + 100 | val_100 | 1000 +(1 row) + +-- Now run exact same queries with single-task OFF +SET citus.enable_single_task_execution TO off; +-- Single-row point lookups (same key values) +SELECT * FROM kv WHERE key = 1; + key | value | num +--------------------------------------------------------------------- + 1 | val_1 | 10 +(1 row) + +SELECT * FROM kv WHERE key = 50; + key | value | num +--------------------------------------------------------------------- + 50 | val_50 | 500 +(1 row) + +SELECT * FROM kv WHERE key = 99; + key | value | num +--------------------------------------------------------------------- + 99 | val_99 | 990 +(1 row) + +-- Point lookup with expressions +SELECT key, upper(value) AS uval, num + 100 AS shifted FROM kv WHERE key = 42; + key | uval | shifted +--------------------------------------------------------------------- + 42 | VAL_42 | 520 +(1 row) + +-- Multi-row: all rows for a shard key value +SELECT * FROM kv_multi WHERE key = 5 ORDER BY seq; + key | seq | payload +--------------------------------------------------------------------- + 5 | 50 | x + 5 | 51 | xx + 5 | 52 | xxx + 5 | 53 | xxxx + 5 | 54 | xxxxx + 5 | 55 | xxxxxx + 5 | 56 | xxxxxxx + 5 | 57 | xxxxxxxx + 5 | 58 | xxxxxxxxx + 5 | 59 | xxxxxxxxxx +(10 rows) + +-- Multi-row with aggregate +SELECT key, count(*), max(length(payload)) FROM kv_multi WHERE key = 10 GROUP BY key; + key | count | max +--------------------------------------------------------------------- + 10 | 10 | 10 +(1 row) + +-- ============================================================ +-- PART 3: Complex fast-path queries that still qualify +-- ============================================================ +SET citus.enable_single_task_execution TO on; +-- Subquery in target list +SELECT key, (SELECT count(*) FROM kv_multi m WHERE m.key = kv.key) AS child_count +FROM kv WHERE key = 5; + key | child_count +--------------------------------------------------------------------- + 5 | 10 +(1 row) + +-- CASE expression +SELECT key, + CASE WHEN num > 500 THEN 'high' WHEN num > 200 THEN 'mid' ELSE 'low' END AS tier +FROM kv WHERE key = 50; + key | tier +--------------------------------------------------------------------- + 50 | mid +(1 row) + +-- Coalesce and NULL handling +SELECT key, coalesce(value, 'missing') AS val, coalesce(NULL::int, num, 0) AS n +FROM kv WHERE key = 1; + key | val | n +--------------------------------------------------------------------- + 1 | val_1 | 10 +(1 row) + +-- Multiple conditions on same shard key (key = X AND ...) +SELECT * FROM kv WHERE key = 42 AND num > 100 AND value LIKE 'val%'; + key | value | num +--------------------------------------------------------------------- + 42 | val_42 | 420 +(1 row) + +-- ORDER BY with LIMIT on multi-row table +SELECT * FROM kv_multi WHERE key = 5 ORDER BY seq DESC LIMIT 3; + key | seq | payload +--------------------------------------------------------------------- + 5 | 59 | xxxxxxxxxx + 5 | 58 | xxxxxxxxx + 5 | 57 | xxxxxxxx +(3 rows) + +-- FOR UPDATE (supported for replication_factor = 1) +SELECT * FROM kv WHERE key = 10 FOR UPDATE; + key | value | num +--------------------------------------------------------------------- + 10 | val_10 | 100 +(1 row) + +-- CTE that reads from same shard +WITH recent AS ( + SELECT * FROM kv_multi WHERE key = 8 ORDER BY seq DESC LIMIT 5 +) +SELECT key, seq, length(payload) AS plen FROM recent ORDER BY seq; + key | seq | plen +--------------------------------------------------------------------- + 8 | 85 | 36 + 8 | 86 | 37 + 8 | 87 | 38 + 8 | 88 | 39 + 8 | 89 | 40 +(5 rows) + +-- ============================================================ +-- PART 4: Queries that should NOT use single-task executor +-- ============================================================ +-- Multi-shard query (no equality on distribution column) +EXPLAIN (COSTS OFF) SELECT count(*) FROM kv; + QUERY PLAN +--------------------------------------------------------------------- + Aggregate + -> Custom Scan (Citus Adaptive) + Task Count: 4 + Tasks Shown: One of 4 + -> Task + Node: host=localhost port=xxxxx dbname=regression + -> Aggregate + -> Seq Scan on kv_99900000 kv +(8 rows) + +-- Range condition on distribution column +EXPLAIN (COSTS OFF) SELECT * FROM kv WHERE key > 50; + QUERY PLAN +--------------------------------------------------------------------- + Custom Scan (Citus Adaptive) + Task Count: 4 + Tasks Shown: One of 4 + -> Task + Node: host=localhost port=xxxxx dbname=regression + -> Bitmap Heap Scan on kv_99900000 kv + Recheck Cond: (key > 50) + -> Bitmap Index Scan on kv_pkey_99900000 + Index Cond: (key > 50) +(9 rows) + +-- ============================================================ +-- PART 5: GUC toggle - disabled means plans revert to full adaptive +-- ============================================================ +SET citus.enable_single_task_execution TO off; +-- Same query that was Single Task before should now show "Citus Adaptive" +EXPLAIN (COSTS OFF) SELECT * FROM kv WHERE key = 1; + QUERY PLAN +--------------------------------------------------------------------- + Custom Scan (Citus Adaptive) + Task Count: 1 + Tasks Shown: All + -> Task + Node: host=localhost port=xxxxx dbname=regression + -> Index Scan using kv_pkey_99900000 on kv_99900000 kv + Index Cond: (key = 1) +(7 rows) + +EXPLAIN (COSTS OFF) UPDATE kv SET value = 'x' WHERE key = 1; + QUERY PLAN +--------------------------------------------------------------------- + Custom Scan (Citus Adaptive) + Task Count: 1 + Tasks Shown: All + -> Task + Node: host=localhost port=xxxxx dbname=regression + -> Update on kv_99900000 kv + -> Index Scan using kv_pkey_99900000 on kv_99900000 kv + Index Cond: (key = 1) +(8 rows) + +-- ============================================================ +-- Cleanup +-- ============================================================ +SET citus.enable_single_task_execution TO on; +DROP SCHEMA single_task_execution CASCADE; +NOTICE: drop cascades to 2 other objects +DETAIL: drop cascades to table kv +drop cascades to table kv_multi diff --git a/src/test/regress/expected/sqlancer_failures.out b/src/test/regress/expected/sqlancer_failures.out index c6df1f68d33..20e6d7c8dd1 100644 --- a/src/test/regress/expected/sqlancer_failures.out +++ b/src/test/regress/expected/sqlancer_failures.out @@ -67,7 +67,7 @@ EXPLAIN (COSTS FALSE) SELECT FROM t4 WHERE c1 = 2 BETWEEN 1 AND 3; EXPLAIN (COSTS FALSE) SELECT FROM t4 WHERE c1 = true; QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) + Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task @@ -87,7 +87,7 @@ INSERT INTO t5 VALUES (CASE WHEN 2 BETWEEN 1 AND 3 THEN 2 ELSE 1 END); EXPLAIN (COSTS FALSE) SELECT FROM t5 WHERE c0 = 2; QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) + Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task diff --git a/src/test/regress/expected/upgrade_basic_after.out b/src/test/regress/expected/upgrade_basic_after.out index 2ce25bc5428..eadcfd35a10 100644 --- a/src/test/regress/expected/upgrade_basic_after.out +++ b/src/test/regress/expected/upgrade_basic_after.out @@ -75,7 +75,7 @@ EXPLAIN (COSTS FALSE) SELECT * from t; EXPLAIN (COSTS FALSE) SELECT * from t WHERE a = 1; QUERY PLAN --------------------------------------------------------------------- - Custom Scan (Citus Adaptive) + Custom Scan (Citus Single Task) Task Count: 1 Tasks Shown: All -> Task diff --git a/src/test/regress/expected/upgrade_basic_after_0.out b/src/test/regress/expected/upgrade_basic_after_0.out new file mode 100644 index 00000000000..2ce25bc5428 --- /dev/null +++ b/src/test/regress/expected/upgrade_basic_after_0.out @@ -0,0 +1,318 @@ +SET search_path TO upgrade_basic, public, pg_catalog; +BEGIN; +-- We have the tablename filter to avoid adding an alternative output for when the coordinator is in metadata vs when not +SELECT * FROM pg_indexes WHERE schemaname = 'upgrade_basic' and tablename NOT LIKE 'r_%' ORDER BY tablename; + schemaname | tablename | indexname | tablespace | indexdef +--------------------------------------------------------------------- + upgrade_basic | r | r_pkey | | CREATE UNIQUE INDEX r_pkey ON upgrade_basic.r USING btree (a) + upgrade_basic | t | t_a_idx | | CREATE INDEX t_a_idx ON upgrade_basic.t USING hash (a) + upgrade_basic | tp | tp_pkey | | CREATE UNIQUE INDEX tp_pkey ON upgrade_basic.tp USING btree (a) +(3 rows) + +SELECT logicalrelid FROM pg_dist_partition + JOIN pg_depend ON logicalrelid=objid + JOIN pg_catalog.pg_class ON logicalrelid=oid + WHERE + refobjid=(select oid FROM pg_extension WHERE extname = 'citus') + AND relnamespace='upgrade_basic'::regnamespace + ORDER BY logicalrelid; + logicalrelid +--------------------------------------------------------------------- + t + tp + t_ab + r + tr + t_range +(6 rows) + +SELECT tgrelid::regclass, tgfoid::regproc, tgisinternal, tgenabled, tgtype::int4::bit(8) + FROM pg_dist_partition + JOIN pg_trigger ON tgrelid=logicalrelid + JOIN pg_class ON pg_class.oid=logicalrelid + WHERE + relnamespace='upgrade_basic'::regnamespace + AND tgname LIKE 'truncate_trigger_%' + ORDER BY tgrelid::regclass; + tgrelid | tgfoid | tgisinternal | tgenabled | tgtype +--------------------------------------------------------------------- + t | citus_truncate_trigger | t | O | 00100000 + tp | citus_truncate_trigger | t | O | 00100000 + t_ab | citus_truncate_trigger | t | O | 00100000 + r | citus_truncate_trigger | t | O | 00100000 + tr | citus_truncate_trigger | t | O | 00100000 + t_range | citus_truncate_trigger | t | O | 00100000 +(6 rows) + +SELECT * FROM t ORDER BY a; + a +--------------------------------------------------------------------- + 1 + 2 + 3 + 4 + 5 +(5 rows) + +SELECT * FROM t WHERE a = 1; + a +--------------------------------------------------------------------- + 1 +(1 row) + +INSERT INTO t SELECT * FROM generate_series(10, 15); +EXPLAIN (COSTS FALSE) SELECT * from t; + QUERY PLAN +--------------------------------------------------------------------- + Custom Scan (Citus Adaptive) + Task Count: 32 + Tasks Shown: One of 32 + -> Task + Node: host=localhost port=xxxxx dbname=postgres + -> Seq Scan on t_102008 t +(6 rows) + +EXPLAIN (COSTS FALSE) SELECT * from t WHERE a = 1; + QUERY PLAN +--------------------------------------------------------------------- + Custom Scan (Citus Adaptive) + Task Count: 1 + Tasks Shown: All + -> Task + Node: host=localhost port=xxxxx dbname=postgres + -> Bitmap Heap Scan on t_102009 t + Recheck Cond: (a = 1) + -> Bitmap Index Scan on t_a_idx_102009 + Index Cond: (a = 1) +(9 rows) + +SELECT * FROM t WHERE a = 10; + a +--------------------------------------------------------------------- + 10 +(1 row) + +SELECT * FROM t WHERE a = 11; + a +--------------------------------------------------------------------- + 11 +(1 row) + +COPY t FROM PROGRAM 'echo 20 && echo 21 && echo 22 && echo 23 && echo 24' WITH CSV; +ALTER TABLE t ADD COLUMN b int DEFAULT 10; +SELECT * FROM t ORDER BY a; + a | b +--------------------------------------------------------------------- + 1 | 10 + 2 | 10 + 3 | 10 + 4 | 10 + 5 | 10 + 10 | 10 + 11 | 10 + 12 | 10 + 13 | 10 + 14 | 10 + 15 | 10 + 20 | 10 + 21 | 10 + 22 | 10 + 23 | 10 + 24 | 10 +(16 rows) + +TRUNCATE TABLE t; +SELECT * FROM T; + a | b +--------------------------------------------------------------------- +(0 rows) + +DROP TABLE t; +\d t +-- verify that the table whose column is dropped before a pg_upgrade still works as expected. +SELECT * FROM t_ab ORDER BY b; + b +--------------------------------------------------------------------- + 11 + 22 + 33 +(3 rows) + +SELECT * FROM t_ab WHERE b = 11; + b +--------------------------------------------------------------------- + 11 +(1 row) + +SELECT * FROM t_ab WHERE b = 22; + b +--------------------------------------------------------------------- + 22 +(1 row) + +-- Check that we can create a distributed table out of a table that was created +-- before the upgrade +SELECT * FROM t2 ORDER BY a; + a | b +--------------------------------------------------------------------- + 1 | 11 + 2 | 22 + 3 | 33 +(3 rows) + +SELECT create_distributed_table('t2', 'a'); +NOTICE: Copying data from local table... +NOTICE: copying the data has completed +DETAIL: The local data in the table is no longer visible, but is still on disk. +HINT: To remove the local data, run: SELECT truncate_local_data_after_distributing_table($$upgrade_basic.t2$$) + create_distributed_table +--------------------------------------------------------------------- + +(1 row) + +SELECT * FROM t2 ORDER BY a; + a | b +--------------------------------------------------------------------- + 1 | 11 + 2 | 22 + 3 | 33 +(3 rows) + +ROLLBACK; +BEGIN; +SET LOCAL citus.multi_shard_modify_mode TO 'sequential'; +SELECT * FROM r ORDER BY a; + a +--------------------------------------------------------------------- + 1 + 2 + 3 + 4 + 5 +(5 rows) + +SELECT * FROM tr ORDER BY pk; + pk | a +--------------------------------------------------------------------- + 1 | 1 + 2 | 2 + 3 | 3 + 4 | 4 + 5 | 5 +(5 rows) + +DELETE FROM r where a = 1; +SELECT * FROM r ORDER BY a; + a +--------------------------------------------------------------------- + 2 + 3 + 4 + 5 +(4 rows) + +SELECT * FROM tr ORDER BY pk; + pk | a +--------------------------------------------------------------------- + 2 | 2 + 3 | 3 + 4 | 4 + 5 | 5 +(4 rows) + +UPDATE r SET a = 30 WHERE a = 3; +SELECT * FROM r ORDER BY a; + a +--------------------------------------------------------------------- + 2 + 4 + 5 + 30 +(4 rows) + +SELECT * FROM tr ORDER BY pk; + pk | a +--------------------------------------------------------------------- + 2 | 2 + 3 | 30 + 4 | 4 + 5 | 5 +(4 rows) + +-- Check we can still create distributed tables after upgrade +CREATE TABLE t3(a int, b int); +SELECT create_distributed_table('t3', 'a'); + create_distributed_table +--------------------------------------------------------------------- + +(1 row) + +INSERT INTO t3 VALUES (1, 11); +INSERT INTO t3 VALUES (2, 22); +INSERT INTO t3 VALUES (3, 33); +SELECT * FROM t3 ORDER BY a; + a | b +--------------------------------------------------------------------- + 1 | 11 + 2 | 22 + 3 | 33 +(3 rows) + +SELECT shardminvalue, shardmaxvalue FROM pg_dist_shard + WHERE logicalrelid = 't_range'::regclass + ORDER BY shardminvalue, shardmaxvalue; + shardminvalue | shardmaxvalue +--------------------------------------------------------------------- + 1 | 3 + 5 | 7 +(2 rows) + +SELECT * FROM t_range ORDER BY id; + id | value_1 +--------------------------------------------------------------------- + 1 | 2 + 2 | 3 + 3 | 4 + 5 | 2 + 6 | 3 + 7 | 4 +(6 rows) + +SELECT master_create_empty_shard('t_range') AS new_shard_id \gset +UPDATE pg_dist_shard SET shardminvalue = '9', shardmaxvalue = '11' WHERE shardid = :new_shard_id; +\copy t_range FROM STDIN with (DELIMITER ',') +SELECT shardminvalue, shardmaxvalue FROM pg_dist_shard + WHERE logicalrelid = 't_range'::regclass + ORDER BY shardminvalue, shardmaxvalue; + shardminvalue | shardmaxvalue +--------------------------------------------------------------------- + 1 | 3 + 5 | 7 + 9 | 11 +(3 rows) + +SELECT * FROM t_range ORDER BY id; + id | value_1 +--------------------------------------------------------------------- + 1 | 2 + 2 | 3 + 3 | 4 + 5 | 2 + 6 | 3 + 7 | 4 + 9 | 2 + 10 | 3 + 11 | 4 +(9 rows) + +ROLLBACK; +-- There is a difference in partkey Var representation between PG16 and older versions +-- There is also a difference between PG18 and older versions +-- Sanity check here that we can properly do column_to_column_name +SELECT column_to_column_name(logicalrelid, partkey) +FROM pg_dist_partition WHERE partkey IS NOT NULL ORDER BY 1 LIMIT 1; + column_to_column_name +--------------------------------------------------------------------- + a +(1 row) + diff --git a/src/test/regress/multi_1_schedule b/src/test/regress/multi_1_schedule index 3a89a6bcfd7..1673bf93c5f 100644 --- a/src/test/regress/multi_1_schedule +++ b/src/test/regress/multi_1_schedule @@ -225,10 +225,11 @@ test: pg_dump # --------- test: multi_copy fast_path_router_modify test: multi_router_planner -# These 2 tests have prepared statements which sometimes get invalidated by concurrent tests, -# changing the debug output. We should not run them in parallel with others +# These tests have prepared statements which sometimes get invalidated by concurrent tests, +# changing the debug output. We should not run them in parallel with others or each other. test: null_parameters test: multi_router_planner_fast_path +test: single_task_execution # ---------- # multi_large_shardid loads more lineitem data using high shard identifiers diff --git a/src/test/regress/sql/failure_connection_establishment.sql b/src/test/regress/sql/failure_connection_establishment.sql index e516cad4c47..4de8d73dde4 100644 --- a/src/test/regress/sql/failure_connection_establishment.sql +++ b/src/test/regress/sql/failure_connection_establishment.sql @@ -111,6 +111,7 @@ RESET citus.node_connection_timeout; SELECT citus.mitmproxy('conn.allow()'); SET citus.shard_replication_factor TO 1; +SET citus.enable_single_task_execution TO false; -- use adaptive executor for predictable error messages CREATE TABLE single_replicatated(key int); SELECT create_distributed_table('single_replicatated', 'key'); diff --git a/src/test/regress/sql/failure_multi_dml.sql b/src/test/regress/sql/failure_multi_dml.sql index f62ede4d503..dc4dcdd47ac 100644 --- a/src/test/regress/sql/failure_multi_dml.sql +++ b/src/test/regress/sql/failure_multi_dml.sql @@ -2,6 +2,7 @@ SELECT citus.mitmproxy('conn.allow()'); SET citus.shard_count = 2; SET citus.shard_replication_factor = 1; -- one shard per worker +SET citus.enable_single_task_execution TO false; -- use adaptive executor for predictable error messages SET citus.next_shard_id TO 103400; ALTER SEQUENCE pg_catalog.pg_dist_placement_placementid_seq RESTART 100; @@ -114,6 +115,7 @@ SELECT master_run_on_worker( ARRAY['localhost']::text[], ARRAY[:master_port]::int[], ARRAY[' +SET citus.enable_single_task_execution TO false; BEGIN; DELETE FROM dml_test WHERE id = 1; DELETE FROM dml_test WHERE id = 2; diff --git a/src/test/regress/sql/failure_savepoints.sql b/src/test/regress/sql/failure_savepoints.sql index 9291989a41a..b8c40363fea 100644 --- a/src/test/regress/sql/failure_savepoints.sql +++ b/src/test/regress/sql/failure_savepoints.sql @@ -6,6 +6,7 @@ SELECT citus.mitmproxy('conn.allow()'); SET citus.shard_count = 2; SET citus.shard_replication_factor = 1; -- one shard per worker +SET citus.enable_single_task_execution TO false; -- use adaptive executor for predictable error messages SET citus.next_shard_id TO 100950; SET client_min_messages TO ERROR; ALTER SEQUENCE pg_catalog.pg_dist_placement_placementid_seq RESTART 150; diff --git a/src/test/regress/sql/failure_single_select.sql b/src/test/regress/sql/failure_single_select.sql index c8218c95046..bab08371660 100644 --- a/src/test/regress/sql/failure_single_select.sql +++ b/src/test/regress/sql/failure_single_select.sql @@ -86,6 +86,7 @@ SET citus.max_cached_conns_per_worker TO 0; -- purge cache DROP TABLE select_test; SET citus.shard_count = 2; SET citus.shard_replication_factor = 1; +SET citus.enable_single_task_execution TO false; -- use adaptive executor for predictable error messages CREATE TABLE select_test (key int, value text); SELECT create_distributed_table('select_test', 'key'); diff --git a/src/test/regress/sql/local_shard_execution.sql b/src/test/regress/sql/local_shard_execution.sql index 688896f56d0..ef9fbad16cb 100644 --- a/src/test/regress/sql/local_shard_execution.sql +++ b/src/test/regress/sql/local_shard_execution.sql @@ -13,7 +13,7 @@ CREATE TABLE reference_table (key int PRIMARY KEY); SELECT create_reference_table('reference_table'); CREATE TABLE distributed_table (key int PRIMARY KEY , value text, age bigint CHECK (age > 10), FOREIGN KEY (key) REFERENCES reference_table(key) ON DELETE CASCADE); -SELECT create_distributed_table('distributed_table','key'); +SELECT create_distributed_table('distributed_table','key', colocate_with => 'none'); CREATE TABLE second_distributed_table (key int PRIMARY KEY , value text, FOREIGN KEY (key) REFERENCES distributed_table(key) ON DELETE CASCADE); SELECT create_distributed_table('second_distributed_table','key'); @@ -33,7 +33,7 @@ CREATE TABLE collections_list ( PRIMARY KEY(key, collection_id) ) PARTITION BY LIST (collection_id ); -SELECT create_distributed_table('collections_list', 'key'); +SELECT create_distributed_table('collections_list', 'key', colocate_with => 'none'); CREATE TABLE collections_list_0 PARTITION OF collections_list (key, ser, ts, collection_id, value) @@ -60,7 +60,7 @@ INSERT INTO accounts (id) VALUES ('foo'); INSERT INTO stats (account_id, spent) VALUES ('foo', 100); CREATE TABLE abcd(a int, b int, c int, d int); -SELECT create_distributed_table('abcd', 'b'); +SELECT create_distributed_table('abcd', 'b', colocate_with => 'none'); INSERT INTO abcd VALUES (1,2,3,4); INSERT INTO abcd VALUES (2,3,4,5); @@ -943,7 +943,7 @@ CREATE TABLE event_responses ( primary key (event_id, user_id) ); -SELECT create_distributed_table('event_responses', 'event_id'); +SELECT create_distributed_table('event_responses', 'event_id', colocate_with => 'none'); INSERT INTO event_responses VALUES (1, 1, 'yes'), (2, 2, 'yes'), (3, 3, 'no'), (4, 4, 'no'); @@ -954,7 +954,7 @@ CREATE TABLE event_responses_no_pkey ( response invite_resp ); -SELECT create_distributed_table('event_responses_no_pkey', 'event_id'); +SELECT create_distributed_table('event_responses_no_pkey', 'event_id', colocate_with => 'event_responses'); @@ -1437,10 +1437,35 @@ ALTER SYSTEM SET citus.local_hostname TO 'foobar'; SELECT pg_reload_conf(); SELECT pg_sleep(0.1); -- wait to make sure the config has changed before running the GUC SET citus.enable_local_execution TO false; -- force a connection to the dummy placements +SET citus.enable_single_task_execution TO false; -- use adaptive executor for predictable error messages -- run queries that use dummy placements for local execution -SELECT * FROM event_responses WHERE FALSE; -WITH cte_1 AS (SELECT * FROM event_responses LIMIT 1) SELECT count(*) FROM cte_1; +-- The exact error format depends on DNS resolution timing (pool timeout vs +-- immediate connection failure), so we catch the error and verify it mentions foobar. +DO $$ +BEGIN + PERFORM * FROM event_responses WHERE FALSE; + RAISE NOTICE 'ERROR: should have failed when connecting to foobar'; +EXCEPTION WHEN OTHERS THEN + IF SQLERRM LIKE '%foobar%' THEN + RAISE NOTICE 'correctly attempted connection to foobar'; + ELSE + RAISE NOTICE 'ERROR: unexpected error: %', SQLERRM; + END IF; +END; +$$; +DO $$ +BEGIN + EXECUTE 'WITH cte_1 AS (SELECT * FROM event_responses LIMIT 1) SELECT count(*) FROM cte_1'; + RAISE NOTICE 'ERROR: should have failed when connecting to foobar'; +EXCEPTION WHEN OTHERS THEN + IF SQLERRM LIKE '%foobar%' THEN + RAISE NOTICE 'correctly attempted connection to foobar'; + ELSE + RAISE NOTICE 'ERROR: unexpected error: %', SQLERRM; + END IF; +END; +$$; ALTER SYSTEM RESET citus.local_hostname; SELECT pg_reload_conf(); diff --git a/src/test/regress/sql/multi_router_planner_fast_path.sql b/src/test/regress/sql/multi_router_planner_fast_path.sql index f9b13483f90..cc22819bc8d 100644 --- a/src/test/regress/sql/multi_router_planner_fast_path.sql +++ b/src/test/regress/sql/multi_router_planner_fast_path.sql @@ -639,6 +639,8 @@ SELECT count(*), count(*) FILTER (WHERE id < 3) WHERE author_id = 1; -- prepare queries can be router plannable +-- force custom plan to avoid flaky DEBUG output from generic plan transition +SET plan_cache_mode TO force_custom_plan; PREPARE author_1_articles as SELECT * FROM articles_hash @@ -650,8 +652,11 @@ EXECUTE author_1_articles; EXECUTE author_1_articles; EXECUTE author_1_articles; EXECUTE author_1_articles; +RESET plan_cache_mode; -- parametric prepare queries can be router plannable +-- force custom plan to avoid flaky DEBUG output from generic plan transition +SET plan_cache_mode TO force_custom_plan; PREPARE author_articles(int) as SELECT * FROM articles_hash @@ -682,6 +687,7 @@ EXECUTE author_articles_update(NULL); EXECUTE author_articles_update(NULL); EXECUTE author_articles_update(NULL); EXECUTE author_articles_update(NULL); +RESET plan_cache_mode; -- queries inside plpgsql functions could be router plannable CREATE OR REPLACE FUNCTION author_articles_max_id() RETURNS int AS $$ diff --git a/src/test/regress/sql/multi_transaction_recovery.sql b/src/test/regress/sql/multi_transaction_recovery.sql index b1072fe6b3d..f873a7dc07b 100644 --- a/src/test/regress/sql/multi_transaction_recovery.sql +++ b/src/test/regress/sql/multi_transaction_recovery.sql @@ -9,11 +9,16 @@ SET citus.force_max_query_parallelization TO ON; ALTER SYSTEM SET citus.recover_2pc_interval TO -1; SELECT pg_reload_conf(); --- Ensure pg_dist_transaction is empty +-- Ensure pg_dist_transaction is empty for a clean start SELECT recover_prepared_transactions(); +DELETE FROM pg_dist_transaction; -- Create some "fake" prepared transactions to recover +-- Clean up any leftover tables from previous runs \c - - - :worker_1_port +SET client_min_messages TO WARNING; +DROP TABLE IF EXISTS should_abort, should_commit, should_be_sorted_into_middle; +RESET client_min_messages; BEGIN; CREATE TABLE should_abort (value int); @@ -28,6 +33,9 @@ CREATE TABLE should_be_sorted_into_middle (value int); PREPARE TRANSACTION 'citus_0_should_be_sorted_into_middle'; \c - - - :master_port +SET client_min_messages TO WARNING; +DROP TABLE IF EXISTS should_abort, should_commit, should_be_sorted_into_middle; +RESET client_min_messages; BEGIN; CREATE TABLE should_abort (value int); @@ -43,10 +51,13 @@ PREPARE TRANSACTION 'citus_0_should_be_sorted_into_middle'; SET citus.force_max_query_parallelization TO ON; -- Add "fake" pg_dist_transaction records and run recovery -INSERT INTO pg_dist_transaction VALUES (1, 'citus_0_should_commit'), - (0, 'citus_0_should_commit'); -INSERT INTO pg_dist_transaction VALUES (1, 'citus_0_should_be_forgotten'), - (0, 'citus_0_should_be_forgotten'); +-- Use dynamic group IDs so this works regardless of which cluster setup ran +INSERT INTO pg_dist_transaction + VALUES ((SELECT groupid FROM pg_dist_node WHERE nodeport = :worker_1_port AND nodecluster = 'default' LIMIT 1), 'citus_0_should_commit'), + (0, 'citus_0_should_commit'); +INSERT INTO pg_dist_transaction + VALUES ((SELECT groupid FROM pg_dist_node WHERE nodeport = :worker_1_port AND nodecluster = 'default' LIMIT 1), 'citus_0_should_be_forgotten'), + (0, 'citus_0_should_be_forgotten'); SELECT recover_prepared_transactions(); SELECT count(*) FROM pg_dist_transaction; @@ -126,6 +137,7 @@ SELECT recover_prepared_transactions(); -- Create a single-replica table to enable 2PC in multi-statement transactions SET citus.shard_replication_factor TO 1; +SET citus.enable_single_task_execution TO false; -- use adaptive executor for predictable 2PC behavior CREATE TABLE test_recovery_single (LIKE test_recovery); -- creating distributed table should write 2 transaction recovery records @@ -186,6 +198,9 @@ SELECT create_distributed_table('test_2pcskip', 'a'); INSERT INTO test_2pcskip SELECT i FROM generate_series(0, 5)i; SELECT recover_prepared_transactions(); +SET client_min_messages TO WARNING; +DROP TABLE IF EXISTS selected_shard; +RESET client_min_messages; SELECT shardid INTO selected_shard FROM citus_shards WHERE table_name='test_2pcskip'::regclass AND nodeport = :worker_1_port @@ -257,3 +272,7 @@ DROP TABLE test_recovery; DROP TABLE test_recovery_single; DROP TABLE test_2pcskip; DROP TABLE test_reference; +SET client_min_messages TO WARNING; +DROP TABLE IF EXISTS selected_shard; +DROP TABLE IF EXISTS should_abort, should_commit, should_be_sorted_into_middle; +RESET client_min_messages; diff --git a/src/test/regress/sql/single_task_execution.sql b/src/test/regress/sql/single_task_execution.sql new file mode 100644 index 00000000000..4ee5c99ba5b --- /dev/null +++ b/src/test/regress/sql/single_task_execution.sql @@ -0,0 +1,158 @@ +-- +-- SINGLE_TASK_EXECUTION +-- +-- Validates the single-task (one-task) adaptive executor: +-- 1. Produces identical results to the full adaptive executor +-- 2. Shows "Citus Single Task" in EXPLAIN plans +-- 3. Handles single-row and multi-row results +-- 4. Covers simple and complex fast-path queries +-- +CREATE SCHEMA single_task_execution; +SET search_path TO single_task_execution; +SET citus.next_shard_id TO 99900000; +SET citus.shard_count TO 4; +SET citus.shard_replication_factor TO 1; + +-- Create test tables +CREATE TABLE kv (key int PRIMARY KEY, value text, num int); +SELECT create_distributed_table('kv', 'key'); + +CREATE TABLE kv_multi (key int, seq int, payload text, PRIMARY KEY (key, seq)); +SELECT create_distributed_table('kv_multi', 'key'); + +-- Load test data: single-row per key in kv, multiple rows per key in kv_multi +INSERT INTO kv SELECT g, 'val_' || g, g * 10 FROM generate_series(1, 100) g; +INSERT INTO kv_multi SELECT g / 10, g, repeat('x', g % 50 + 1) FROM generate_series(1, 200) g; + +-- ============================================================ +-- PART 1: EXPLAIN validation - confirm plan uses Single Task executor +-- ============================================================ + +-- Simple point SELECT +EXPLAIN (COSTS OFF) SELECT * FROM kv WHERE key = 1; + +-- Point UPDATE +EXPLAIN (COSTS OFF) UPDATE kv SET value = 'updated' WHERE key = 1; + +-- Point DELETE +EXPLAIN (COSTS OFF) DELETE FROM kv WHERE key = 1; + +-- INSERT with ON CONFLICT +EXPLAIN (COSTS OFF) INSERT INTO kv (key, value, num) VALUES (1, 'x', 0) + ON CONFLICT (key) DO UPDATE SET num = kv.num + 1; + +-- SELECT with expression in target list +EXPLAIN (COSTS OFF) SELECT key, upper(value), num * 2 AS doubled FROM kv WHERE key = 42; + +-- SELECT with LIMIT (still single-shard, should use single-task) +EXPLAIN (COSTS OFF) SELECT * FROM kv WHERE key = 5 LIMIT 1; + +-- Multi-row per shard key: point lookup with multiple results +EXPLAIN (COSTS OFF) SELECT * FROM kv_multi WHERE key = 5 ORDER BY seq; + +-- ============================================================ +-- PART 2: Results equivalence - ON vs OFF must produce same results +-- ============================================================ + +-- Run queries with single-task ON and capture results +SET citus.enable_single_task_execution TO on; + +-- Single-row point lookups +SELECT * FROM kv WHERE key = 1; +SELECT * FROM kv WHERE key = 50; +SELECT * FROM kv WHERE key = 99; + +-- Point lookup with expressions +SELECT key, upper(value) AS uval, num + 100 AS shifted FROM kv WHERE key = 42; + +-- Multi-row: all rows for a shard key value +SELECT * FROM kv_multi WHERE key = 5 ORDER BY seq; + +-- Multi-row with aggregate +SELECT key, count(*), max(length(payload)) FROM kv_multi WHERE key = 10 GROUP BY key; + +-- UPDATE RETURNING +UPDATE kv SET num = num + 1 WHERE key = 7 RETURNING key, num; + +-- INSERT ON CONFLICT RETURNING +INSERT INTO kv (key, value, num) VALUES (7, 'conflict', 999) + ON CONFLICT (key) DO UPDATE SET num = kv.num + 1 + RETURNING key, value, num; + +-- DELETE RETURNING +DELETE FROM kv WHERE key = 100 RETURNING *; + +-- Now run exact same queries with single-task OFF +SET citus.enable_single_task_execution TO off; + +-- Single-row point lookups (same key values) +SELECT * FROM kv WHERE key = 1; +SELECT * FROM kv WHERE key = 50; +SELECT * FROM kv WHERE key = 99; + +-- Point lookup with expressions +SELECT key, upper(value) AS uval, num + 100 AS shifted FROM kv WHERE key = 42; + +-- Multi-row: all rows for a shard key value +SELECT * FROM kv_multi WHERE key = 5 ORDER BY seq; + +-- Multi-row with aggregate +SELECT key, count(*), max(length(payload)) FROM kv_multi WHERE key = 10 GROUP BY key; + +-- ============================================================ +-- PART 3: Complex fast-path queries that still qualify +-- ============================================================ +SET citus.enable_single_task_execution TO on; + +-- Subquery in target list +SELECT key, (SELECT count(*) FROM kv_multi m WHERE m.key = kv.key) AS child_count +FROM kv WHERE key = 5; + +-- CASE expression +SELECT key, + CASE WHEN num > 500 THEN 'high' WHEN num > 200 THEN 'mid' ELSE 'low' END AS tier +FROM kv WHERE key = 50; + +-- Coalesce and NULL handling +SELECT key, coalesce(value, 'missing') AS val, coalesce(NULL::int, num, 0) AS n +FROM kv WHERE key = 1; + +-- Multiple conditions on same shard key (key = X AND ...) +SELECT * FROM kv WHERE key = 42 AND num > 100 AND value LIKE 'val%'; + +-- ORDER BY with LIMIT on multi-row table +SELECT * FROM kv_multi WHERE key = 5 ORDER BY seq DESC LIMIT 3; + +-- FOR UPDATE (supported for replication_factor = 1) +SELECT * FROM kv WHERE key = 10 FOR UPDATE; + +-- CTE that reads from same shard +WITH recent AS ( + SELECT * FROM kv_multi WHERE key = 8 ORDER BY seq DESC LIMIT 5 +) +SELECT key, seq, length(payload) AS plen FROM recent ORDER BY seq; + +-- ============================================================ +-- PART 4: Queries that should NOT use single-task executor +-- ============================================================ + +-- Multi-shard query (no equality on distribution column) +EXPLAIN (COSTS OFF) SELECT count(*) FROM kv; + +-- Range condition on distribution column +EXPLAIN (COSTS OFF) SELECT * FROM kv WHERE key > 50; + +-- ============================================================ +-- PART 5: GUC toggle - disabled means plans revert to full adaptive +-- ============================================================ +SET citus.enable_single_task_execution TO off; + +-- Same query that was Single Task before should now show "Citus Adaptive" +EXPLAIN (COSTS OFF) SELECT * FROM kv WHERE key = 1; +EXPLAIN (COSTS OFF) UPDATE kv SET value = 'x' WHERE key = 1; + +-- ============================================================ +-- Cleanup +-- ============================================================ +SET citus.enable_single_task_execution TO on; +DROP SCHEMA single_task_execution CASCADE;