v42-0008-Refactor-sorting-of-attribute-numbers-in-pg_publ.patch
text/x-patch
Filename: v42-0008-Refactor-sorting-of-attribute-numbers-in-pg_publ.patch
Type: text/x-patch
Part: 0
Patch
Format: format-patch
Series: patch v42-0008
Subject: Refactor sorting of attribute numbers in pg_publication.c and statscmds.c
| File | + | − |
|---|---|---|
| src/backend/catalog/pg_publication.c | 1 | 1 |
| src/backend/commands/statscmds.c | 1 | 1 |
From a3c03ee1b4f6d94d6bf2dc8700c30349271ef9b3 Mon Sep 17 00:00:00 2001 From: Stepan Neretin <sncfmgg@gmail.com> Date: Tue, 11 Jun 2024 12:02:48 +0700 Subject: [PATCH v42 08/12] Refactor sorting of attribute numbers in pg_publication.c and statscmds.c This commit refactors the sorting of attribute numbers in two modules: pg_publication.c and statscmds.c. Instead of using the qsort function with a custom compare function, it utilizes the recently introduced sort_int_16_arr function, which offers enhanced performance for sorting int16 arrays. Details: - Replaced qsort calls with sort_int_16_arr for sorting attribute numbers. - Improved efficiency by utilizing the sorting template for int16 arrays. This change ensures consistency in sorting methods and enhances sorting performance in relevant modules. --- src/backend/catalog/pg_publication.c | 2 +- src/backend/commands/statscmds.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c index 8518582b76..196f696c1e 100644 --- a/src/backend/catalog/pg_publication.c +++ b/src/backend/catalog/pg_publication.c @@ -540,7 +540,7 @@ publication_translate_columns(Relation targetrel, List *columns, } /* Be tidy, so that the catalog representation is always sorted */ - qsort(attarray, n, sizeof(AttrNumber), compare_int16); + sort_int_16_arr(attarray, n); *natts = n; *attrs = attarray; diff --git a/src/backend/commands/statscmds.c b/src/backend/commands/statscmds.c index 14d9b035b7..e448b2d601 100644 --- a/src/backend/commands/statscmds.c +++ b/src/backend/commands/statscmds.c @@ -392,7 +392,7 @@ CreateStatistics(CreateStatsStmt *stmt) * it does not hurt (it does not matter for the contents, unlike for * indexes, for example). */ - qsort(attnums, nattnums, sizeof(int16), compare_int16); + sort_int_16_arr(attnums, nattnums); /* * Check for duplicates in the list of columns. The attnums are sorted so -- 2.34.1