Re: type cache cleanup improvements

2024-04-03 Thread Andrei Lepikhov
On 3/15/24 17:57, Teodor Sigaev wrote: Okay, I've applied this piece for now.  Not sure I'll have much room to look at the rest. Thank you very much! I have spent some time reviewing this feature. I think we can discuss and apply it step-by-step. So, the 0001-* patch is at this moment. The

Re: type cache cleanup improvements

2024-03-28 Thread Жарков Роман
> Rest of patches, rebased. Hello, I read and tested only the first patch so far. Creation of temp tables and rollback in your script work 3-4 times faster with 0001-type-cache.patch on my windows laptop. In the patch I found a copy of the comment "If it's domain over composite, reset

Re: type cache cleanup improvements

2024-03-15 Thread Teodor Sigaev
Okay, I've applied this piece for now. Not sure I'll have much room to look at the rest. Thank you very much! Rest of patches, rebased. -- Teodor Sigaev E-mail: teo...@sigaev.ru WWW:

Re: type cache cleanup improvements

2024-03-14 Thread Michael Paquier
On Thu, Mar 14, 2024 at 04:27:43PM +0300, Teodor Sigaev wrote: >> So I would like to suggest the attached patch for this first piece. >> What do you think? > > I have not any objections Okay, I've applied this piece for now. Not sure I'll have much room to look at the rest. -- Michael

Re: type cache cleanup improvements

2024-03-14 Thread Teodor Sigaev
One thing that first pops out to me is that we can do the refactor of hash_initial_lookup() as an independent piece, without the extra paths introduced. But rather than returning the bucket hash and have the bucket number as an in/out argument of hash_initial_lookup(), there is an argument for

Re: type cache cleanup improvements

2024-03-14 Thread Michael Paquier
On Wed, Mar 13, 2024 at 04:40:38PM +0300, Teodor Sigaev wrote: > Done, all patches should be applied consequentially. One thing that first pops out to me is that we can do the refactor of hash_initial_lookup() as an independent piece, without the extra paths introduced. But rather than returning

Re: type cache cleanup improvements

2024-03-13 Thread Teodor Sigaev
I think that this patch should be split for clarity, as there are a few things that are independently useful. I guess something like that: Done, all patches should be applied consequentially. > - The typcache changes. 01-map_rel_to_type.v5.patch adds map relation to its type - Introduction

Re: type cache cleanup improvements

2024-03-12 Thread Michael Paquier
On Tue, Mar 12, 2024 at 06:55:41PM +0300, Teodor Sigaev wrote: > Playing around I found one more place which could easily modified with > hash_seq_init_with_hash_value() call. I think that this patch should be split for clarity, as there are a few things that are independently useful. I guess

Re: type cache cleanup improvements

2024-03-12 Thread Teodor Sigaev
Got it. Here is an updated patch where I added a corresponding comment. Thank you! Playing around I found one more place which could easily modified with hash_seq_init_with_hash_value() call. -- Teodor Sigaev E-mail: teo...@sigaev.ru

Re: type cache cleanup improvements

2024-03-11 Thread Aleksander Alekseev
Hi, > Yep, exacly. One time from 2^32 we reset whole cache instead of one (or > several) > entry with hash value = 0. Got it. Here is an updated patch where I added a corresponding comment. Now the patch LGTM. I'm going to change its status to RfC unless anyone wants to review it too. --

Re: type cache cleanup improvements

2024-03-08 Thread Teodor Sigaev
Yep, exacly. One time from 2^32 we reset whole cache instead of one (or several) entry with hash value = 0. On 08.03.2024 18:35, Tom Lane wrote: Aleksander Alekseev writes: One thing that I couldn't immediately figure out is why 0 hash value is treated as a magic invalid value in

Re: type cache cleanup improvements

2024-03-08 Thread Tom Lane
Aleksander Alekseev writes: > One thing that I couldn't immediately figure out is why 0 hash value > is treated as a magic invalid value in TypeCacheTypCallback(): I've not read this patch, but IIRC in some places we have a convention that hash value zero is passed for an sinval reset event

Re: type cache cleanup improvements

2024-03-08 Thread Aleksander Alekseev
Hi, > > I would like to tweak the patch a little bit - change some comments, > > add some Asserts, etc. Don't you mind? > You are welcome! Thanks. PFA the updated patch with some tweaks by me. I added the commit message as well. One thing that I couldn't immediately figure out is why 0 hash

Re: type cache cleanup improvements

2024-03-05 Thread Teodor Sigaev
I would like to tweak the patch a little bit - change some comments, add some Asserts, etc. Don't you mind? You are welcome! -- Teodor Sigaev E-mail: teo...@sigaev.ru WWW: http://www.sigaev.ru/

Re: type cache cleanup improvements

2024-03-05 Thread Aleksander Alekseev
Hi, > Thank you for interesting in it! > > > These changes look very promising. Unfortunately the proposed patches > > conflict with each other regardless the order of applying: > > > > ``` > > error: patch failed: src/backend/utils/cache/typcache.c:356 > > error:

Re: type cache cleanup improvements

2024-03-05 Thread Teodor Sigaev
Hi! Thank you for interesting in it! These changes look very promising. Unfortunately the proposed patches conflict with each other regardless the order of applying: ``` error: patch failed: src/backend/utils/cache/typcache.c:356 error: src/backend/utils/cache/typcache.c: patch does not apply

Re: type cache cleanup improvements

2024-03-04 Thread Aleksander Alekseev
Hi Teodor, > I'd like to suggest two independent patches to improve performance of type > cache > cleanup. I found a case where type cache cleanup was a reason for low > performance. In short, customer makes 100 thousand temporary tables in one > transaction. > > 1 mapRelType.patch >It just

type cache cleanup improvements

2024-02-29 Thread Teodor Sigaev
Hi! I'd like to suggest two independent patches to improve performance of type cache cleanup. I found a case where type cache cleanup was a reason for low performance. In short, customer makes 100 thousand temporary tables in one transaction. 1 mapRelType.patch It just adds a local map