public inbox for [email protected]help / color / mirror / Atom feed
[PATCH] fix 2+ messages / 2 participants [nested] [flat]
* [PATCH] fix @ 2021-01-10 21:41 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 2+ messages in thread From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw) --- src/backend/commands/tablecmds.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index d7b9c63e5f..144c27c303 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel, Oid partrelid, parentrelid; LOCKTAG tag; + LockRelId partlockrelid; char *parentrelname; char *partrelname; @@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel, table_close(rel, NoLock); tab->rel = NULL; + partlockrelid.relId = parentrelid; + partlockrelid.dbId = MyDatabaseId; + LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock); + /* Make updated catalog entry visible */ PopActiveSnapshot(); CommitTransactionCommand(); @@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel, errmsg("partition \"%s\" was removed concurrently", partrelname))); tab->rel = rel; - + UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock); } /* Do the final part of detaching */ @@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel) TupleDesc td = RelationGetDescr(partRel); Constraint *n; - constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel)); + List *l = RelationGetPartitionQual(partRel); + Assert(partRel->rd_rel->relispartition); + Assert(l != NIL); + constraintExpr = make_ands_explicit(l); /* If an identical constraint exists, we don't need to create one */ if (td->constr && td->constr->num_check > 0) -- 2.17.0 --kR3zbvD4cgoYnS/6-- ^ permalink raw reply [nested|flat] 2+ messages in thread
* Missing docs for new enable_group_by_reordering GUC @ 2024-06-18 02:32 Bruce Momjian <[email protected]> 0 siblings, 0 replies; 2+ messages in thread From: Bruce Momjian @ 2024-06-18 02:32 UTC (permalink / raw) To: pgsql-hackers; +Cc: Alexander Korotkov <[email protected]> This commit added enable_group_by_reordering: commit 0452b461bc4 Author: Alexander Korotkov <[email protected]> Date: Sun Jan 21 22:21:36 2024 +0200 Explore alternative orderings of group-by pathkeys during optimization. When evaluating a query with a multi-column GROUP BY clause, we can minimize sort operations or avoid them if we synchronize the order of GROUP BY clauses with the ORDER BY sort clause or sort order, which comes from the underlying query tree. Grouping does not imply any ordering, so we can compare the keys in arbitrary order, and a Hash Agg leverages this. But for Group Agg, we simply compared keys in the order specified in the query. This commit explores alternative ordering of the keys, trying to find a cheaper one. The ordering of group keys may interact with other parts of the query, some of which may not be known while planning the grouping. For example, there may be an explicit ORDER BY clause or some other ordering-dependent operation higher up in the query, and using the same ordering may allow using either incremental sort or even eliminating the sort entirely. The patch always keeps the ordering specified in the query, assuming the user might have additional insights. This introduces a new GUC enable_group_by_reordering so that the optimization may be disabled if needed. Discussion: https://postgr.es/m/7c79e6a5-8597-74e8-0671-1c39d124c9d6%40sigaev.ru Author: Andrei Lepikhov, Teodor Sigaev Reviewed-by: Tomas Vondra, Claudio Freire, Gavin Flower, Dmitry Dolgov Reviewed-by: Robert Haas, Pavel Borisov, David Rowley, Zhihong Yu Reviewed-by: Tom Lane, Alexander Korotkov, Richard Guo, Alena Rybakina It mentions it was added as a GUC to postgresql.conf, but I see no SGML docs for this new GUC value. Would someone please add docs for this? Thanks. -- Bruce Momjian <[email protected]> https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you. ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2024-06-18 02:32 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]> 2024-06-18 02:32 Missing docs for new enable_group_by_reordering GUC Bruce Momjian <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox