Re: Performance degradation in Index searches with special characters

2024-10-06 Thread Thomas Munro
On Mon, Oct 7, 2024 at 9:02 AM Shiv Iyer wrote: >- As the string length increases, the performance degrades exponentially > when using special characters. This is due to the collation’s computational > complexity for each additional character comparison. That's a pretty interesting observat

Re: Performance degradation in Index searches with special characters

2024-10-06 Thread Shiv Iyer
Hi Andrey, I have tried my best to answer your queries below: ### Performance Degradation with Special Characters in PostgreSQL **Explanation**: The performance degradation you're experiencing when using special characters like `<`, `@`, `#`, etc., is likely due to how PostgreSQL handles *

Re: Performance degradation in Index searches with special characters

2024-10-06 Thread Tom Lane
Joe Conway writes: > This is not surprising. There is a performance regression that started > in glibc 2.21 with regard to sorting unicode. Test with RHEL 7.x (glibc > 2.17) and I bet you will see comparable results to ICU. The best answer > in the long term, IMHO, is likely to use the new buil

Re: Performance degradation in Index searches with special characters

2024-10-06 Thread Joe Conway
On 10/6/24 13:28, Andrey Stikheev wrote: Thanks for your feedback. After looking into it further, it seems the performance issue is indeed related to the default collation settings, particularly when handling certain special characters like |<| in the glibc |strcoll_l| function. This was confir

Re: Performance degradation in Index searches with special characters

2024-10-06 Thread Andrey Stikheev
Hi, Tom! Thanks for your feedback. After looking into it further, it seems the performance issue is indeed related to the default collation settings, particularly when handling certain special characters like < in the glibc strcoll_l function. This was confirmed during my testing on Debian 12 wit

Re: Performance degradation in Index searches with special characters

2024-10-06 Thread Tom Lane
Andrey Stikheev writes: >- Changing the collation to 'C' in the query significantly improves >performance. What collation are you using, pray tell? (And what database encoding?) >- Is this performance degradation expected due to collation handling of >certain special characters

Performance degradation in Index searches with special characters

2024-10-06 Thread Andrey Stikheev
Dear PostgreSQL Community, I am facing significant performance issues when executing queries that involve string comparisons with special characters, such as <, #, !, @, etc., especially when dealing with long strings. The query execution time increases drastically when these characters are used,