v42-0003-Enhanced-Sorting-Efficiency-for-Oid-Lists.patch
text/x-patch
Filename: v42-0003-Enhanced-Sorting-Efficiency-for-Oid-Lists.patch
Type: text/x-patch
Part: 9
Patch
Format: format-patch
Series: patch v42-0003
Subject: Enhanced Sorting Efficiency for Oid Lists
| File | + | − |
|---|---|---|
| src/backend/catalog/heap.c | 1 | 1 |
| src/backend/catalog/pg_publication.c | 1 | 1 |
| src/backend/utils/cache/relcache.c | 2 | 2 |
From d82427a4c1db68c59e1d5a35f25f0391a6ae68e6 Mon Sep 17 00:00:00 2001 From: Stepan Neretin <sncfmgg@gmail.com> Date: Sat, 8 Jun 2024 00:04:59 +0700 Subject: [PATCH v42 03/12] Enhanced Sorting Efficiency for Oid Lists Refactored the sorting of lists containing Oids by replacing the generic function with the custom optimized function. This change leverages a custom sort template to enhance performance specifically for Oid types. Details: - Updated to use instead of. - Updated to use instead of. - Updated to use instead of in two locations. This refactor aims to improve sorting efficiency for Oid lists, reducing processing time and enhancing overall system performance. --- src/backend/catalog/heap.c | 2 +- src/backend/catalog/pg_publication.c | 2 +- src/backend/utils/cache/relcache.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index a122bbffce..88e4ada970 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -3303,7 +3303,7 @@ restart: list_free(oids); /* Now sort and de-duplicate the result list */ - list_sort(result, list_oid_cmp); + list_oid_sort(result); list_deduplicate_oid(result); return result; diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c index 0602398a54..faf70ec8c7 100644 --- a/src/backend/catalog/pg_publication.c +++ b/src/backend/catalog/pg_publication.c @@ -746,7 +746,7 @@ GetPublicationRelations(Oid pubid, PublicationPartOpt pub_partopt) table_close(pubrelsrel, AccessShareLock); /* Now sort and de-duplicate the result list */ - list_sort(result, list_oid_cmp); + list_oid_sort(result); list_deduplicate_oid(result); return result; diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 35dbb87ae3..21b3f3c92f 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -4873,7 +4873,7 @@ RelationGetIndexList(Relation relation) table_close(indrel, AccessShareLock); /* Sort the result list into OID order, per API spec. */ - list_sort(result, list_oid_cmp); + list_oid_sort(result); /* Now save a copy of the completed list in the relcache entry. */ oldcxt = MemoryContextSwitchTo(CacheMemoryContext); @@ -4965,7 +4965,7 @@ RelationGetStatExtList(Relation relation) table_close(indrel, AccessShareLock); /* Sort the result list into OID order, per API spec. */ - list_sort(result, list_oid_cmp); + list_oid_sort(result); /* Now save a copy of the completed list in the relcache entry. */ oldcxt = MemoryContextSwitchTo(CacheMemoryContext); -- 2.34.1