Re: Optimization for lower(), upper(), casefold() functions.

From: Alexander Borisov <lex(dot)borisov(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Optimization for lower(), upper(), casefold() functions.
Date: 2025-03-14 12:00:57
Message-ID: 5b6a619b-58dc-4f55-8398-97595f559794@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

14.03.2025 06:43, Jeff Davis wrote:
> On Wed, 2025-03-12 at 23:39 +0300, Alexander Borisov wrote:
>> v5 attached.
>
> Attached v6j.

I like the current changes.
Some comments:

[...]
> * modified perl code so that it produces code that's already pgindented
> * cleanup of perl code, removing unnecessary subroutines and variables

Does it make sense to arrange table creation in this way (lower, title,
upper, fold, special), don't you think it complicates code perception,
it turns out to be just copy-past.
Previously, the creation of these tables was done in a loop, which
required little code and understandable.

I tried adding a loop to create tables, and everything looks fine (v7).
Also removed unnecessary (hanging) global variables.

> * added a few comments
> * ran pgperltidy
>
> Some of the perl code working with ranges still needs further cleanup
> and explanation, though.

It's all about not getting too carried away. In my vision these
subroutines (user-defined functions) will have to be moved to perl
module (.pm) in the future, after the patch is committed, so that the
code can be used for Normalization Forms.

So it seems that removing the branch_function() sub, or rather
simplifying it and writing it in place, was unnecessary.
But it is not terrible.

v7 attached.

Regards,
Alexander Borisov

Attachment Content-Type Size
v7-0001-Optimization-for-lower-upper-casefold-functions.patch text/plain 765.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2025-03-14 12:06:25 Re: Reducing memory consumed by RestrictInfo list translations in partitionwise join planning
Previous Message Álvaro Herrera 2025-03-14 11:16:43 Re: bogus error message for ALTER TABLE ALTER CONSTRAINT