From: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com> |
---|---|
To: | 'Heikki Linnakangas' <hlinnaka(at)iki(dot)fi>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, Jeff Davis <pgsql(at)j-davis(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Shubham Khanna <khannashubham1197(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Subject: | RE: Improve eviction algorithm in ReorderBuffer |
Date: | 2024-04-11 01:46:37 |
Message-ID: | OSBPR01MB2552025406D6DEBF7EB8FDA7F5052@OSBPR01MB2552.jpnprd01.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Dear Heikki,
I also prototyped the idea, which has almost the same shape.
I attached just in case, but we may not have to see.
Few comments based on the experiment.
```
+ /* txn_heap is ordered by transaction size */
+ buffer->txn_heap = pairingheap_allocate(ReorderBufferTXNSizeCompare, NULL);
```
I think the pairing heap should be in the same MemoryContext with the buffer.
Can we add MemoryContextSwithTo()?
```
+ /* Update the max-heap */
+ if (oldsize != 0)
+ pairingheap_remove(rb->txn_heap, &txn->txn_node);
+ pairingheap_add(rb->txn_heap, &txn->txn_node);
...
+ /* Update the max-heap */
+ pairingheap_remove(rb->txn_heap, &txn->txn_node);
+ if (txn->size != 0)
+ pairingheap_add(rb->txn_heap, &txn->txn_node);
```
Since the number of stored transactions does not affect to the insert operation, we may able
to add the node while creating ReorederBufferTXN and remove while cleaning up it. This can
reduce branches in ReorderBufferChangeMemoryUpdate().
Best Regards,
Hayato Kuroda
FUJITSU LIMITED
https://www.fujitsu.com/
Attachment | Content-Type | Size |
---|---|---|
patchset.zip | application/x-zip-compressed | 11.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | David Steele | 2024-04-11 01:52:00 | Re: post-freeze damage control |
Previous Message | David Steele | 2024-04-11 01:36:30 | pg_combinebackup does not detect missing files |