Re: Avoid is possible a expensive function call (src/backend/utils/adt/varlena.c)

2024-03-05 Thread Ranier Vilela
Em seg., 4 de mar. de 2024 às 20:28, Tom Lane escreveu: > Michael Paquier writes: > > On Mon, Mar 04, 2024 at 03:08:03PM -0300, Ranier Vilela wrote: > >> I can't see any user validation at the function > pg_newlocale_from_collation. > > > Matthias is right, look closer. I can see more than one

Re: Avoid is possible a expensive function call (src/backend/utils/adt/varlena.c)

2024-03-04 Thread Tom Lane
Michael Paquier writes: > On Mon, Mar 04, 2024 at 03:08:03PM -0300, Ranier Vilela wrote: >> I can't see any user validation at the function pg_newlocale_from_collation. > Matthias is right, look closer. I can see more than one check, > especially note the one related to the collation version

Re: Avoid is possible a expensive function call (src/backend/utils/adt/varlena.c)

2024-03-04 Thread Michael Paquier
On Mon, Mar 04, 2024 at 03:08:03PM -0300, Ranier Vilela wrote: > I can't see any user validation at the function pg_newlocale_from_collation. Matthias is right, look closer. I can see more than one check, especially note the one related to the collation version mismatch that should not be

Re: Avoid is possible a expensive function call (src/backend/utils/adt/varlena.c)

2024-03-04 Thread Ranier Vilela
Em seg., 4 de mar. de 2024 às 14:54, Matthias van de Meent < boekewurm+postg...@gmail.com> escreveu: > On Mon, 4 Mar 2024 at 18:39, Ranier Vilela wrote: > > > > Hi, > > > > The function var_strcmp is a critical function. > > Inside the function, there is a shortcut condition, > > which allows

Re: Avoid is possible a expensive function call (src/backend/utils/adt/varlena.c)

2024-03-04 Thread Matthias van de Meent
On Mon, 4 Mar 2024 at 18:39, Ranier Vilela wrote: > > Hi, > > The function var_strcmp is a critical function. > Inside the function, there is a shortcut condition, > which allows for a quick exit. > > Unfortunately, the current code calls a very expensive function beforehand, > which if the test

Avoid is possible a expensive function call (src/backend/utils/adt/varlena.c)

2024-03-04 Thread Ranier Vilela
Hi, The function var_strcmp is a critical function. Inside the function, there is a shortcut condition, which allows for a quick exit. Unfortunately, the current code calls a very expensive function beforehand, which if the test was true, all the call time is wasted. So, IMO, it's better to