Re: BufferAlloc: don't take two simultaneous locks

2022-02-21 Thread Yura Sokolov
Good day, Kyotaro Horiguchi and hackers. В Чт, 17/02/2022 в 14:16 +0900, Kyotaro Horiguchi пишет: > At Wed, 16 Feb 2022 10:40:56 +0300, Yura Sokolov > wrote in > > Hello, all. > > > > I thought about patch simplification, and tested version > > without BufTable

Re: Accommodate startup process in a separate ProcState array slot instead of in MaxBackends slots.

2022-02-21 Thread Yura Sokolov
В Сб, 12/02/2022 в 16:56 +0530, Bharath Rupireddy пишет: > On Fri, Feb 11, 2022 at 7:56 PM Yura Sokolov wrote: > > В Сб, 16/10/2021 в 16:37 +0530, Bharath Rupireddy пишет: > > > On Thu, Oct 14, 2021 at 10:56 AM Fujii Masao > > > wrote: > > > > On 20

Re: BufferAlloc: don't take two simultaneous locks

2022-02-25 Thread Yura Sokolov
Hello, Simon. В Пт, 25/02/2022 в 04:35 +, Simon Riggs пишет: > On Mon, 21 Feb 2022 at 08:06, Yura Sokolov wrote: > > Good day, Kyotaro Horiguchi and hackers. > > > > В Чт, 17/02/2022 в 14:16 +0900, Kyotaro Horiguchi пишет: > > > At Wed, 16 Feb 2022 10:40:56 +03

Re: BufferAlloc: don't take two simultaneous locks

2022-02-25 Thread Yura Sokolov
Hello, Andres В Пт, 25/02/2022 в 00:04 -0800, Andres Freund пишет: > Hi, > > On 2022-02-21 11:06:49 +0300, Yura Sokolov wrote: > > From 04b07d0627ec65ba3327dc8338d59dbd15c405d8 Mon Sep 17 00:00:00 2001 > > From: Yura Sokolov > > Date: Mon, 21 Feb 2022 08:49:03 +

Re: BufferAlloc: don't take two simultaneous locks

2022-02-27 Thread Yura Sokolov
В Пт, 25/02/2022 в 09:01 -0800, Andres Freund пишет: > Hi, > > On 2022-02-25 12:51:22 +0300, Yura Sokolov wrote: > > > > +* The usage_count starts out at 1 so that the buffer can > > > > survive one > > > > +* clock-sweep pass. > &

Re: BufferAlloc: don't take two simultaneous locks

2022-02-28 Thread Yura Sokolov
В Пт, 25/02/2022 в 09:38 +, Simon Riggs пишет: > On Fri, 25 Feb 2022 at 09:24, Yura Sokolov wrote: > > > > This approach is cleaner than v1, but should also perform better > > > because there will be a 1:1 relationship between a buffer and its > > >

Re: BufferAlloc: don't take two simultaneous locks

2022-03-02 Thread Yura Sokolov
В Вт, 01/03/2022 в 10:24 +0300, Yura Sokolov пишет: > Ok, here is v4. And here is v5. First, there was compilation error in Assert in dynahash.c . Excuse me for not checking before sending previous version. Second, I add third commit that reduces HASHHDR allocation size for non-partitio

Re: BufferAlloc: don't take two simultaneous locks

2022-03-11 Thread Yura Sokolov
В Пт, 11/03/2022 в 15:30 +0900, Kyotaro Horiguchi пишет: > At Thu, 03 Mar 2022 01:35:57 +0300, Yura Sokolov > wrote in > > В Вт, 01/03/2022 в 10:24 +0300, Yura Sokolov пишет: > > > Ok, here is v4. > > > > And here is v5. > > > > First, there

Re: BufferAlloc: don't take two simultaneous locks

2022-03-11 Thread Yura Sokolov
and !reuse cases but > BufTableInsert doesn't and always does HASH_ASSIGN. That looks > odd. We should use HASH_ENTER here. Thus I think it is more > reasonable that HASH_ENTRY uses the stashed entry if exists and > needed, or returns it to freelist if exists but not needed. > > What do you think about this? Well... I don't like it but I don't mind either. Code in HASH_ENTER and HASH_ASSIGN cases differs much. On the other hand, probably it is possible to merge it carefuly. I'll try. - regards Yura Sokolov

Re: BufferAlloc: don't take two simultaneous locks

2022-03-13 Thread Yura Sokolov
, except for their "init" forks, which need to be > > treated > >* just like permanent relations. > >* > >* The usage_count starts out at 1 so that the buffer can survive one > >* clock-sweep pass. > > But if you think th

Re: BufferAlloc: don't take two simultaneous locks

2022-03-13 Thread Yura Sokolov
12GB RAM... we doubtfully trigger problem before OOM killer came. Does Windows have an OOM killer?) > Subject: [PATCH 3/3] reduce memory allocation for non-partitioned dynahash > > memory allocation -> memory allocations For each dynahash instance single allocation were reduced. I th

Re: BufferAlloc: don't take two simultaneous locks

2022-03-13 Thread Yura Sokolov
May be there should be bitmap for non-empty free lists? 32bit for 32 partitions. But wouldn't bitmap became contention point itself? > No need to do something for the possible deviation issue. --- regards Yura Sokolov

Re: BufferAlloc: don't take two simultaneous locks

2022-03-14 Thread Yura Sokolov
В Пн, 14/03/2022 в 17:12 +0900, Kyotaro Horiguchi пишет: > At Mon, 14 Mar 2022 09:15:11 +0300, Yura Sokolov > wrote in > > В Пн, 14/03/2022 в 14:31 +0900, Kyotaro Horiguchi пишет: > > > I'd like to ask you to remove nalloced from partitions then add a > >

Re: BufferAlloc: don't take two simultaneous locks

2022-03-14 Thread Yura Sokolov
В Пн, 14/03/2022 в 14:57 +0300, Yura Sokolov пишет: > В Пн, 14/03/2022 в 17:12 +0900, Kyotaro Horiguchi пишет: > > At Mon, 14 Mar 2022 09:15:11 +0300, Yura Sokolov > > wrote in > > > В Пн, 14/03/2022 в 14:31 +0900, Kyotaro Horiguchi пишет: > > > > I'

Re: BufferAlloc: don't take two simultaneous locks

2022-03-15 Thread Yura Sokolov
В Вт, 15/03/2022 в 16:25 +0900, Kyotaro Horiguchi пишет: > Thanks for the new version. > > At Tue, 15 Mar 2022 08:07:39 +0300, Yura Sokolov > wrote in > > В Пн, 14/03/2022 в 14:57 +0300, Yura Sokolov пишет: > > > В Пн, 14/03/2022 в 17:12 +0900, Kyotaro Horiguchi пи

Re: BufferAlloc: don't take two simultaneous locks

2022-03-15 Thread Yura Sokolov
В Вт, 15/03/2022 в 13:47 +0300, Yura Sokolov пишет: > В Вт, 15/03/2022 в 16:25 +0900, Kyotaro Horiguchi пишет: > > > I lost access to Xeon 8354H, so returned to old Xeon X5675. > > ... > > > Strange thing: both master and patched version has higher > > > peak tp

Re: BufferAlloc: don't take two simultaneous locks

2022-03-15 Thread Yura Sokolov
В Вт, 15/03/2022 в 13:47 +0300, Yura Sokolov пишет: > В Вт, 15/03/2022 в 16:25 +0900, Kyotaro Horiguchi пишет: > > Thanks for the new version. > > > > At Tue, 15 Mar 2022 08:07:39 +0300, Yura Sokolov > > wrote in > > > В Пн, 14/03/2022 в 14:57 +0300, Yur

Re: BufferAlloc: don't take two simultaneous locks

2022-03-16 Thread Yura Sokolov
В Ср, 16/03/2022 в 12:07 +0900, Kyotaro Horiguchi пишет: > At Tue, 15 Mar 2022 13:47:17 +0300, Yura Sokolov > wrote in > > В Вт, 15/03/2022 в 16:25 +0900, Kyotaro Horiguchi пишет: > > > Hmm. v8 returns stashed element with original patition index when the > > >

Declare PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY for aarch64

2022-03-16 Thread Yura Sokolov
PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY for aarch64 [1] https://documentation-service.arm.com/static/61fbe8f4fa8173727a1b734e https://developer.arm.com/documentation/ddi0487/latest --- regards Yura Sokolov Postgres Professional y.soko...@postgrespro.ru funny.fal...@gmail.com From

Re: BufferAlloc: don't take two simultaneous locks

2022-03-20 Thread Yura Sokolov
В Чт, 17/03/2022 в 12:02 +0900, Kyotaro Horiguchi пишет: > At Wed, 16 Mar 2022 14:11:58 +0300, Yura Sokolov > wrote in > > В Ср, 16/03/2022 в 12:07 +0900, Kyotaro Horiguchi пишет: > > > At Tue, 15 Mar 2022 13:47:17 +0300, Yura Sokolov > > > wrote in >

Re: BufferAlloc: don't take two simultaneous locks

2021-12-20 Thread Yura Sokolov
В Сб, 02/10/2021 в 01:25 +0300, Yura Sokolov пишет: > Good day. > > I found some opportunity in Buffer Manager code in BufferAlloc > function: > - When valid buffer is evicted, BufferAlloc acquires two partition > lwlocks: for partition for evicted block is in and partiti

Fix BUG #17335: Duplicate result rows in Gather node

2021-12-30 Thread Yura Sokolov
gr.es/m/17500.1551669976%40sss.pgh.pa.us [2] https://postgr.es/m/CAKJS1f_Wt_tL3S32R3wpU86zQjuHfbnZbFt0eqm%3DqcRFcdbLvw%40mail.gmail.com ---- regards Yura Sokolov y.soko...@postgrespro.ru funny.fal...@gmail.com From 47c6e161de4fc9d2d6eff45f427ebf49b4c9d11c Mon Sep 17 00:00:00 2001 From: Yura Sokolov Date: M

Re: Fix BUG #17335: Duplicate result rows in Gather node

2022-01-16 Thread Yura Sokolov
В Сб, 01/01/2022 в 15:19 +1300, David Rowley пишет: > On Fri, 31 Dec 2021 at 00:14, Yura Sokolov wrote: > > Problem: > > - Append path is created with explicitely parallel_aware = true > > - It has two child, one is trivial, other is parallel_aware = false . > >

Old Postgresql version on i7-1165g7

2021-04-09 Thread Yura Sokolov
erefore I couldn't tell if this bug of 11 series or bug of concrete CPU installed in the notebook. It will be great if some with i7-11* could try to make check and report if it also fails or not. With regards, Yura Sokolov PostgresPro

Re: Old Postgresql version on i7-1165g7

2021-04-13 Thread Yura Sokolov
Yura Sokolov писал 2021-04-09 16:28: Good day, hackers. I've got HP ProBook 640g8 with i7-1165g7. I've installed Ubuntu 20.04 LTS on it and started to play with PostgreSQL sources. Occasinally I found I'm not able to `make check` old Postgresql versions. At least 9.6 a

Re: Double partition lock in bufmgr

2021-10-11 Thread Yura Sokolov
В Пт, 18/12/2020 в 15:20 +0300, Konstantin Knizhnik пишет: > Hi hackers, > > I am investigating incident with one of out customers: performance of > the system isdropped dramatically. > Stack traces of all backends can be found here: > http://www.garret.ru/diag_20201217_102056.stacks_59644 > (th

Re: XTS cipher mode for cluster file encryption

2021-10-24 Thread Yura Sokolov
] https://en.wikipedia.org/wiki/Adiantum_(cipher) [3] https://tosc.iacr.org/index.php/ToSC/article/view/7360 [4] https://github.com/google/adiantum [5] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=059c2a4d8e164dccc3078e49e7f286023b019a98 --- regards Yura Sokolov y.soko...@postgrespro.ru funny.fal...@gmail.com

Re: XTS cipher mode for cluster file encryption

2021-10-25 Thread Yura Sokolov
В Пн, 25/10/2021 в 12:12 -0400, Stephen Frost пишет: > Greetings, > > * Yura Sokolov (y.soko...@postgrespro.ru) wrote: > > В Чт, 21/10/2021 в 13:28 -0400, Stephen Frost пишет: > > > I really don't think this is necessary. Similar to PageSetChecksumCopy > > >

Re: XTS cipher mode for cluster file encryption

2021-10-26 Thread Yura Sokolov
В Вт, 26/10/2021 в 11:08 +0800, Sasasu пишет: > On 2021/10/26 04:32, Yura Sokolov wrote: > > And among others Adiantum looks best: it is fast even without hardware > > acceleration, > > No, AES is fast on modern high-end hardware. > > on X86 AMD 3700X > type

Re: [HACKERS] Lazy hash table for XidInMVCCSnapshot (helps Zipfian a bit)

2018-04-01 Thread Yura Sokolov
17.03.2018 03:36, Tomas Vondra пишет: > > On 03/17/2018 12:03 AM, Yura Sokolov wrote: >> 16.03.2018 04:23, Tomas Vondra пишет: >>> >>> ... >>> >>> OK, a few more comments. >>> >>> 1) The code in ExtendXipSizeForHash seems so

Re: [HACKERS] Lazy hash table for XidInMVCCSnapshot (helps Zipfian a bit)

2018-04-01 Thread Yura Sokolov
23.03.2018 17:59, Amit Kapila пишет: > On Sat, Mar 10, 2018 at 7:41 AM, Yura Sokolov wrote: >> 08.03.2018 03:42, Tomas Vondra пишет: >>> One reason against building the hash table in GetSnapshotData is that >>> we'd build it even when the snapshot is never queried

Re: [HACKERS] Block level parallel vacuum

2018-10-31 Thread Yura Sokolov
Excuse me for being noisy. Increasing vacuum's ring buffer improves vacuum upto 6 times. https://www.postgresql.org/message-id/flat/20170720190405.GM1769%40tamriel.snowman.net This is one-line change. How much improvement parallel vacuum gives? 31.10.2018 3:23, Masahiko Sawada пишет: > On Tue, O

Re: [HACKERS] Small improvement to compactify_tuples

2018-02-25 Thread Yura Sokolov
23.01.2018 06:34, Stephen Frost пишет: > Greetings, > > * Юрий Соколов (funny.fal...@gmail.com) wrote: >> On Wed, Nov 29, 2017 at 8:00 AM, Peter Geoghegan wrote: >>> On Tue, Nov 28, 2017 at 2:41 PM, Andres Freund wrote: Maybe it's a stupid question. But would we still want to have this afte

Re: [HACKERS] Small improvement to compactify_tuples

2018-03-04 Thread Yura Sokolov
01.03.2018 22:22, Andres Freund пишет: > Hi, > > On 2018-02-25 21:39:46 +0300, Yura Sokolov wrote: >>> If that's the case then does it really make sense to make this change..? >> >> I don't think it is really necessary to implement generic version >>

Re: [HACKERS] Lazy hash table for XidInMVCCSnapshot (helps Zipfian a bit)

2018-03-05 Thread Yura Sokolov
05.03.2018 18:00, Tom Lane пишет: > Tomas Vondra writes: >> Snapshots are static (we don't really add new XIDs into existing ones, >> right?), so why don't we simply sort the XIDs and then use bsearch to >> lookup values? That should fix the linear search, without need for any >> local hash table.

Re: [HACKERS] Lazy hash table for XidInMVCCSnapshot (helps Zipfian a bit)

2018-03-09 Thread Yura Sokolov
08.03.2018 03:42, Tomas Vondra пишет: > On 03/06/2018 06:23 AM, Yura Sokolov wrote: >> 05.03.2018 18:00, Tom Lane пишет: >>> Tomas Vondra writes: >>>> Snapshots are static (we don't really add new XIDs into existing ones, >>>> right?), so why don&#x

Re: [HACKERS] Lazy hash table for XidInMVCCSnapshot (helps Zipfian a bit)

2018-03-16 Thread Yura Sokolov
16.03.2018 04:23, Tomas Vondra пишет: > > > On 03/10/2018 03:11 AM, Yura Sokolov wrote: >> 08.03.2018 03:42, Tomas Vondra пишет: >>> On 03/06/2018 06:23 AM, Yura Sokolov wrote: >>>> 05.03.2018 18:00, Tom Lane пишет: >>>>> Tomas Vondra writes: &

Suggest two small improvements for PITR.

2024-01-11 Thread Yura Sokolov
or both is permitted. If idea is accepted, patches for tests will be applied as well. [1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=patch;h=c945af80 --- Yura Sokolov.From 173cfc3762a97c300b618f863fd23433909cdb81 Mon Sep 17 00:00:00 2001 From: Yura Sokolov Date: Wed, 3 May 2023 18

Re: Bug in jsonb_in function (14 & 15 version are affected)

2023-03-15 Thread Yura Sokolov
their usage in token success or error reporting, - simplify json_lex_number and its usage a bit. Also he added tests for fixed bug. - Regards, Yura Sokolov. From 757a314d5fa9c6ba8334762b4a080763f02244c5 Mon Sep 17 00:00:00 2001 From: Nikita Glukhov Date: Tue, 14 Mar 2023 12:15:48 +0300 Subject: [P

Jumble Query with COERCE_SQL_SYNTAX

2022-03-29 Thread Yura Sokolov
Good day. v14 introduced the way to get original text for some kind of expressions using new 'funcformat' - COERCE_SQL_SYNTAX: - EXTRACT(part from timestamp) - (text IS [form] NORMALIZED) and others. Mentioned EXTRACT and NORMALIZED statements has parts, that are not usual arguments but some kind

Re: Speed up transaction completion faster after many relations are accessed in a transaction

2022-04-05 Thread Yura Sokolov
dlist_push_head`? Resource owners usually form stack, so usually when owner searches for itself it is last added to list. Then `dlist_foreach` will find it sooner if it were added to the head. regards - Yura Sokolov Postgres Professional y.soko...@postgrespro.ru funny.fal...@gmail.com

Re: BufferAlloc: don't take two simultaneous locks

2022-04-06 Thread Yura Sokolov
Good day, Kyotaoro-san. Good day, hackers. В Вс, 20/03/2022 в 12:38 +0300, Yura Sokolov пишет: > В Чт, 17/03/2022 в 12:02 +0900, Kyotaro Horiguchi пишет: > > At Wed, 16 Mar 2022 14:11:58 +0300, Yura Sokolov > > wrote in > > > В Ср, 16/03/2022 в 12:07 +0900, Kyotaro Hor

Re: BufferAlloc: don't take two simultaneous locks

2022-04-07 Thread Yura Sokolov
В Чт, 07/04/2022 в 16:55 +0900, Kyotaro Horiguchi пишет: > Hi, Yura. > > At Wed, 06 Apr 2022 16:17:28 +0300, Yura Sokolov > wrot > e in > > Ok, I got access to stronger server, did the benchmark, found weird > > things, and so here is new version :-) > &g

Re: BufferAlloc: don't take two simultaneous locks

2022-04-13 Thread Yura Sokolov
В Пт, 08/04/2022 в 16:46 +0900, Kyotaro Horiguchi пишет: > At Thu, 07 Apr 2022 14:14:59 +0300, Yura Sokolov > wrote in > > В Чт, 07/04/2022 в 16:55 +0900, Kyotaro Horiguchi пишет: > > > Hi, Yura. > > > > > > At Wed, 06 Apr 2022 16:17:28 +0300, Yura Soko

Re: BufferAlloc: don't take two simultaneous locks

2022-04-21 Thread Yura Sokolov
t did LWLockRelease. Could BufTableInsert elog(ERROR|FATAL)? There is "out of shared memory" which is avoidable with get_hash_entry modifications or with HASH_FIXED_SIZE + some spare items. Could CHECK_FOR_INTERRUPTS raise something? No: there is single line between LWLockRelease and LWLockAcquire, and it doesn't contain CHECK_FOR_INTERRUPTS. Therefore there is single fixable case of "out of shared memory" (by HASH_FIXED_SIZE or improvements to "get_hash_entry"). May be I'm not quite right at some point. I'd glad to learn. - regards Yura Sokolov

Re: BufferAlloc: don't take two simultaneous locks

2022-04-21 Thread Yura Sokolov
В Чт, 21/04/2022 в 16:24 -0400, Robert Haas пишет: > On Thu, Apr 21, 2022 at 5:04 AM Yura Sokolov wrote: > > $ pid=`ps x | awk '/checkpointer/ && !/awk/ { print $1 }'` > > $ gdb -p $pid -batch -ex 'p SharedBufHash->hctl->allocated.value' >

Re: BufferAlloc: don't take two simultaneous locks

2022-04-22 Thread Yura Sokolov
Btw, I've runned tests on EPYC (80 cores). 1 key per select conns | master | patch-v11 | master 1G | patch-v11 1G ++++ 1 | 29053 | 28959 | 26715 | 25631 2 | 53714 | 53002 | 55211 |

Re: Vectorization of some functions and improving pg_list interface

2023-09-06 Thread Yura Sokolov
24.08.2023 17:07, Maxim Orlov wrote: Hi! Recently, I've been playing around with pg_lists and realize how annoying (maybe, I was a bit tired) some stuff related to the lists. For an example, see this code List *l1 = list_make4(1, 2, 3, 4), *l2 = list_make4(5, 6, 7, 8),

Re: Vectorization of some functions and improving pg_list interface

2023-09-06 Thread Yura Sokolov
06.09.2023 13:24, Yura Sokolov wrote: 24.08.2023 17:07, Maxim Orlov wrote: Hi! Recently, I've been playing around with pg_lists and realize how annoying (maybe, I was a bit tired) some stuff related to the lists. For an example, see this code List *l1 = list_make4(1, 2,

Re: Fix BUG #17335: Duplicate result rows in Gather node

2022-01-23 Thread Yura Sokolov
В Чт, 20/01/2022 в 09:32 +1300, David Rowley пишет: > On Fri, 31 Dec 2021 at 00:14, Yura Sokolov wrote: > > Suggested quick (and valid) fix in the patch attached: > > - If Append has single child, then copy its parallel awareness. > > I've been looking at this and I&#

Re: Fix BUG #17335: Duplicate result rows in Gather node

2022-01-24 Thread Yura Sokolov
В Вс, 23/01/2022 в 14:56 +0300, Yura Sokolov пишет: > В Чт, 20/01/2022 в 09:32 +1300, David Rowley пишет: > > On Fri, 31 Dec 2021 at 00:14, Yura Sokolov wrote: > > > Suggested quick (and valid) fix in the patch attached: > > > - If Append has single child, then

Re: Fix BUG #17335: Duplicate result rows in Gather node

2022-01-24 Thread Yura Sokolov
В Пн, 24/01/2022 в 16:24 +0300, Yura Sokolov пишет: > В Вс, 23/01/2022 в 14:56 +0300, Yura Sokolov пишет: > > В Чт, 20/01/2022 в 09:32 +1300, David Rowley пишет: > > > On Fri, 31 Dec 2021 at 00:14, Yura Sokolov > > > wrote: > > > > Suggested quic

Re: Fix BUG #17335: Duplicate result rows in Gather node

2022-01-25 Thread Yura Sokolov
В Вт, 25/01/2022 в 21:20 +1300, David Rowley пишет: > On Tue, 25 Jan 2022 at 20:03, David Rowley wrote: > > On Tue, 25 Jan 2022 at 17:35, Yura Sokolov wrote: > > > And another attempt to fix tests volatility. > > > > FWIW, I had not really seen the point in addin

Re: Accommodate startup process in a separate ProcState array slot instead of in MaxBackends slots.

2022-02-11 Thread Yura Sokolov
a way to > specify that in the form an Assert(when_i_am_startup_proc && > autovacuum_not_running) (this looks a bit dirty though)? Instead, we > can just enlarge the array in the master and be confident about the > fact that the startup process always has one dedicated slot. But this slot wont be used for most of cluster life. It will be just waste. And `Assert(there_is_startup_proc && autovacuum_not_running)` has value on its own, hasn't it? So why doesn't add it with comment. regards, Yura Sokolov

Re: Error "initial slot snapshot too large" in create replication slot

2022-02-13 Thread Yura Sokolov
think more comments should be written about new usage case for `takenDuringRecovery`. May be this field should be renamed at all? And there are checks for `takenDuringRecovery` in `heapgetpage` and `heapam_scan_sample_next_tuple`. Are this checks affected by the change? Neither the preceding discussion nor commit message answer me. --- regards Yura Sokolov Postgres Professional y.soko...@postgrespro.ru funny.fal...@gmail.com

Re: BufferAlloc: don't take two simultaneous locks

2022-02-15 Thread Yura Sokolov
32 newHashValue, > LWLock *oldPartitionLock, > LWLock *newPartitionLock > ); Interesting suggestion, thanks. I'll think about. It has downside of bringing LWLock knowdlege to dynahash.c . But otherwise looks smart. - regards, Yura Sokolov

Re: BufferAlloc: don't take two simultaneous locks

2022-02-15 Thread Yura Sokolov
nchmarking and will attach graphs with next message. Patch is attached here. -- regards, Yura Sokolov Postgres Professional y.soko...@postgrespro.ru funny.fal...@gmail.com From 7f430bdaa748456ed6b59f16f32ac0ea55644a66 Mon Sep 17 00:00:00 2001 From: Yura Sokolov Date: Fri, 14 Jan 2022 02:2

Re: Old Postgresql version on i7-1165g7

2021-04-18 Thread Yura Sokolov
Tom Lane писал 2021-04-13 17:45: Justin Pryzby writes: On Fri, Apr 09, 2021 at 04:28:25PM +0300, Yura Sokolov wrote: Occasinally I found I'm not able to `make check` old Postgresql versions. I've bisected between REL_11_0 and "Rename pg_rewind's copy_file

Re: Old Postgresql version on i7-1165g7

2021-04-19 Thread Yura Sokolov
Yura Sokolov писал 2021-04-18 23:29: Tom Lane писал 2021-04-13 17:45: Justin Pryzby writes: On Fri, Apr 09, 2021 at 04:28:25PM +0300, Yura Sokolov wrote: Occasinally I found I'm not able to `make check` old Postgresql versions. I've bisected between REL_11_0 and "Ren

Re: Use simplehash.h instead of dynahash in SMgr

2021-04-24 Thread Yura Sokolov
David Rowley писал 2021-04-24 18:58: Hackers, Last year, when working on making compactify_tuples() go faster for 19c60ad69, I did quite a bit of benchmarking of the recovery process. The next thing that was slow after compactify_tuples() was the hash lookups done in smgropen(). Currently, we u

Re: Use simplehash.h instead of dynahash in SMgr

2021-04-24 Thread Yura Sokolov
David Rowley писал 2021-04-25 05:23: Thanks for having a look at this. "On Sun, 25 Apr 2021 at 10:27, Yura Sokolov wrote: It is quite interesting result. Simplehash being open-addressing with linear probing is friendly for cpu cache. I'd recommend to define SH_FILLFACTOR with v

Re: Use simplehash.h instead of dynahash in SMgr

2021-04-25 Thread Yura Sokolov
David Rowley писал 2021-04-25 16:36: On Sun, 25 Apr 2021 at 18:48, Yura Sokolov wrote: If you read comments in SH_START_ITERATE, you'll see: * Search for the first empty element. As deletions during iterations are * supported, we want to start/end at an element that cannot be aff

Re: Use simplehash.h instead of dynahash in SMgr

2021-04-26 Thread Yura Sokolov
Andres Freund писал 2021-04-26 21:46: Hi, On 2021-04-25 01:27:24 +0300, Yura Sokolov wrote: It is quite interesting result. Simplehash being open-addressing with linear probing is friendly for cpu cache. I'd recommend to define SH_FILLFACTOR with value lower than default (0.9). I believe

Re: Use simplehash.h instead of dynahash in SMgr

2021-04-28 Thread Yura Sokolov
asurable improvement, I think it is ready for commit fest. regards, Yura Sokolov. Postgres Proffesional https://www.postgrespro.com PS. David, please send patch once again since my mail client reattached files in previous messages, and commit fest robot could think I'm author.

Re: Use simplehash.h instead of dynahash in SMgr

2021-04-28 Thread Yura Sokolov
David Rowley писал 2021-04-29 02:51: On Thu, 29 Apr 2021 at 00:28, Yura Sokolov wrote: The best result is with just: return (uint32)rnode->node.relNode; ie, relNode could be taken without mixing at all. relNode is unique inside single database, and almost unique among whole clus

Re: Use simplehash.h instead of dynahash in SMgr

2021-05-07 Thread Yura Sokolov
The following review has been posted through the commitfest application: make installcheck-world: tested, passed Implements feature: tested, passed Spec compliant: tested, passed Documentation:not tested I believe it is ready for committer. The new status of this patc

Re: plan with result cache is very slow when work_mem is not enough

2021-05-07 Thread Yura Sokolov
s through whole cache hashtable, therefore it reaches quadratic complexity easily (or more correct M*N, where M - size of a table, N - eviction count). regards, Yura Sokolov

Re: plan with result cache is very slow when work_mem is not enough

2021-05-08 Thread Yura Sokolov
n issue, because those generally work with small data sets. And if you > >run with asserts on large amounts of data, I think this is acceptable. > >I had the same dilemma with the new BRIN index opclasses, which also >have some extensive and expensive assert checks - for the regression >tests that's fine, and it proved very useful during development. > >I have considered enabling those extra checks only on request somehow, >but I'd bet no one would do that and I'd forget it exists pretty soon. > > >regards Perhaps there is need for flag "heavy asserts". Or option "--enable-cassert=heavy". Then USE_ASSERT_CHECKING could be defined to integer 1 or 2 depending on "heaviness" of enabled checks. regards Yura Sokolov

Re: plan with result cache is very slow when work_mem is not enough

2021-05-09 Thread Yura Sokolov
David Rowley писал 2021-05-09 04:01: On Sun, 9 May 2021 at 03:29, Pavel Stehule wrote: Personally, I have not problem with too slow assertions, although it is not too practical. The main problem is some shock, and feeling so some is wrong. I spent 1 hour detecting if it is a bug or not. Than

Add PortalDrop in exec_execute_message

2021-05-19 Thread Yura Sokolov
Hi, hackers. I've been playing with "autoprepared" patch, and have got isolation "freeze-the-dead" test stuck on first VACUUM FREEZE statement. After some research I found issue is reproduced with unmodified master branch if extended protocol used. I've prepared ruby script for demonstration (cau

Re: Add PortalDrop in exec_execute_message

2021-05-24 Thread Yura Sokolov
Tom Lane писал 2021-05-21 21:23: Yura Sokolov writes: I propose to add PortalDrop at the 'if (completed)' branch of exec_execute_message. This violates our wire protocol specification, which specifically says If successfully created, a named portal object lasts till the end o

Re: Add PortalDrop in exec_execute_message

2021-05-27 Thread Yura Sokolov
Alvaro Herrera писал 2021-05-26 23:59: On 2021-May-25, Yura Sokolov wrote: Tom Lane писал 2021-05-21 21:23: > Yura Sokolov writes: > > I propose to add PortalDrop at the 'if (completed)' branch of > > exec_execute_message. > > This violates our wir

Re: Add PortalDrop in exec_execute_message

2021-05-27 Thread Yura Sokolov
is simple and portal is created as seek-able? regards, tom lane regards Yura Sokolov

Clear empty space in a page.

2021-05-29 Thread Yura Sokolov
pact. Sorry, didn't measure impact on raw performance yet. regards, Yura Sokolov aka funny_falconcommit 6abfcaeb87fcb396c5e2dccd434ce2511314ff76 Author: Yura Sokolov Date: Sun May 30 02:39:17 2021 +0300 Clear empty space in a page Write zeroes to just cleared

Re: Clear empty space in a page.

2021-05-31 Thread Yura Sokolov
Hi, Andres Freund wrote 2021-05-31 00:07: Hi, On 2021-05-30 03:10:26 +0300, Yura Sokolov wrote: While this result is not directly applied to stock PostgreSQL, I believe page compression is important for full_page_writes with wal_compression enabled. And probably when PostgreSQL is used on

Re: Add PortalDrop in exec_execute_message

2021-06-10 Thread Yura Sokolov
Alvaro Herrera wrote 2021-06-08 00:07: On 2021-May-27, Yura Sokolov wrote: Alvaro Herrera писал 2021-05-26 23:59: > I don't think they should do that. The portal remains open, and the > libpq interface does that. The portal gets closed at end of transaction > without th

Re: Extensible storage manager API - smgr hooks

2021-06-29 Thread Yura Sokolov
Anastasia Lubennikova писал 2021-06-30 00:49: Hi, hackers! Many recently discussed features can make use of an extensible storage manager API. Namely, storage level compression and encryption [1], [2], [3], disk quota feature [4], SLRU storage changes [5], and any other features that may want to

Re: rand48 replacement

2021-07-03 Thread Yura Sokolov
Fabien COELHO wrote 2021-07-03 11:45: And a v5 where an unused test file does also compile if we insist. About patch: 1. PostgreSQL source uses `uint64` and `uint32`, but not `uint64_t`/`uint32_t` 2. I don't see why pg_prng_state could not be `typedef uint64 pg_prng_state[2];` 3. Then Sample

Re: rand48 replacement

2021-07-04 Thread Yura Sokolov
Fabien COELHO писал 2021-07-04 23:29: The important property of determinism is that if I set a seed, and then make an identical set of calls to the random API, the results will be identical every time, so that it's possible to write tests with predictable/repeatable results. Hmmm… I like my s

Re: rand48 replacement

2021-07-06 Thread Yura Sokolov
Fabien COELHO писал 2021-07-06 09:13: Hello Yura, I believe most "range" values are small, much smaller than UINT32_MAX. In this case, according to [1] fastest method is Lemire's one (I'd take original version from [2]) [...] Yep. I share your point that the range is more often 32 bits. H

Re: rand48 replacement

2021-07-06 Thread Yura Sokolov
Fabien COELHO писал 2021-07-06 23:49: Hello Yura, However, I'm not enthousiastic at combining two methods depending on the range, the function looks complex enough without that, so I would suggest not to take this option. Also, the decision process adds to the average cost, which is undesirable

Re: Multi-Master Logical Replication

2022-04-28 Thread Yura Sokolov
And it is second iteration of MM. First iteration were not "simple" or "easy" already. But even that version had the hidden bug: rare but accumulating data difference between nodes. Attempt to fix this bug led to almost full rewrite of multi-master. (Disclaimer: I had no relation to both MM versions, I just work in the same firm). regards - Yura Sokolov

Re: Multi-Master Logical Replication

2022-04-28 Thread Yura Sokolov
В Чт, 28/04/2022 в 17:37 +0530, vignesh C пишет: > On Thu, Apr 28, 2022 at 4:24 PM Yura Sokolov wrote: > > В Чт, 28/04/2022 в 09:49 +1000, Peter Smith пишет: > > > > > 1.1 ADVANTAGES OF MMLR > > > > > > - Increases write scalability (e.g., all node

Re: BufferAlloc: don't take two simultaneous locks

2022-05-10 Thread Yura Sokolov
В Пт, 06/05/2022 в 10:26 -0400, Robert Haas пишет: > On Thu, Apr 21, 2022 at 6:58 PM Yura Sokolov wrote: > > At the master state: > > - SharedBufHash is not declared as HASH_FIXED_SIZE > > - get_hash_entry falls back to element_alloc too fast (just if it doesn't > &g

Re: PG15 beta1 sort performance regression due to Generation context change

2022-05-27 Thread Yura Sokolov
link. With such change this link had to be encoded in chunk-body itself instead of header. I was confused with this, since there are valgrind hooks, and I was not sure how to change it (I'm not good at valgrind hooks). But after thinking more about I believe it is doable. regards --- Yura Sokolov

Re: PG15 beta1 sort performance regression due to Generation context change

2022-06-02 Thread Yura Sokolov
Fr, 27/05/2022 в 10:51 -0400, Tom Lane writes: > Yura Sokolov writes: > > В Вт, 24/05/2022 в 17:39 -0700, Andres Freund пишет: > > > A variation on your patch would be to only store the offset to the block > > > header - that should always fit into 32bit (huge allocat

Re: BufferAlloc: don't take two simultaneous locks

2022-06-28 Thread Yura Sokolov
В Вт, 28/06/2022 в 14:13 +0300, Yura Sokolov пишет: > Tests: > - tests done on 2 socket Xeon 5220 2.20GHz with turbo bust disabled > (ie max frequency is 2.20GHz) Forgot to mention: - this time it was Centos7.9.2009 (Core) with Linux mn10 3.10.0-1160.el7.x86_64 Perhaps older kernel

Re: BufferAlloc: don't take two simultaneous locks

2022-06-28 Thread Yura Sokolov
В Вт, 28/06/2022 в 14:26 +0300, Yura Sokolov пишет: > В Вт, 28/06/2022 в 14:13 +0300, Yura Sokolov пишет: > > > Tests: > > - tests done on 2 socket Xeon 5220 2.20GHz with turbo bust disabled > > (ie max frequency is 2.20GHz) > > Forgot to mention: > - this

Re: [PATCH] fix wait_event of pg_stat_activity in case of high amount of connections

2022-07-08 Thread Yura Sokolov
В Пт, 08/07/2022 в 09:44 -0400, Robert Haas пишет: > On Thu, Jul 7, 2022 at 10:39 PM Kyotaro Horiguchi > wrote: > > At Thu, 7 Jul 2022 13:58:06 -0500, Justin Pryzby > > wrote in > > > I agree that this is a bug, since it can (and did) cause false positives > > > in a > > > monitoring system. >

Re: [PATCH] fix wait_event of pg_stat_activity in case of high amount of connections

2022-07-08 Thread Yura Sokolov
В Пт, 08/07/2022 в 11:04 -0400, Robert Haas пишет: > On Fri, Jul 8, 2022 at 10:11 AM Yura Sokolov wrote: > > I see analogy with Bus Stop: > > - there is bus stop > > - there is a schedule of bus arriving this top > > - there are passengers, who every day travel

Re: [PATCH] fix wait_event of pg_stat_activity in case of high amount of connections

2022-07-08 Thread Yura Sokolov
В Сб, 09/07/2022 в 02:32 +0300, Yura Sokolov пишет: > В Пт, 08/07/2022 в 11:04 -0400, Robert Haas пишет: > > On Fri, Jul 8, 2022 at 10:11 AM Yura Sokolov > > wrote: > > > I see analogy with Bus Stop: > > > - there is bus stop > > > - there is a schedule

Re: Reducing the chunk header sizes on all memory context types

2022-07-12 Thread Yura Sokolov
Good day, David. В Вт, 12/07/2022 в 17:01 +1200, David Rowley пишет: > Over on [1], I highlighted that 40af10b57 (Use Generation memory > contexts to store tuples in sorts) could cause some performance > regressions for sorts when the size of the tuple is exactly a power of > 2. The reason for th

Re: Reducing the chunk header sizes on all memory context types

2022-07-17 Thread Yura Sokolov
В Вт, 12/07/2022 в 22:41 -0700, Andres Freund пишет: > Hi, > > On 2022-07-12 10:42:07 -0700, Andres Freund wrote: > > On 2022-07-12 17:01:18 +1200, David Rowley wrote: > > > There is at least one. It might be major; to reduce the AllocSet chunk > > > header from 16 bytes down to 8 bytes I had to g

Re: MultiXact\SLRU buffers configuration

2022-07-21 Thread Yura Sokolov
d it consumes large part of patch diff. Rebased versions of first two patch parts are attached. regards, Yura Sokolov slru-ballast.sql Description: application/sql slru-call.sql Description: application/sql slru-func.sql Description: application/sql From 41ec9d1c54184c515d53ecc8021c4a998813f2a9

Re: SLRUs in the main buffer pool, redux

2022-07-21 Thread Yura Sokolov
Good day, Thomas В Пт, 27/05/2022 в 23:24 +1200, Thomas Munro пишет: > Rebased, debugged and fleshed out a tiny bit more, but still with > plenty of TODO notes and questions. I will talk about this idea at > PGCon, so I figured it'd help to have a patch that actually applies, > even if it doesn't

Re: optimize lookups in snapshot [sub]xip arrays

2022-07-24 Thread Yura Sokolov
tgr.es/m/35960b8af917e9268881cd8df3f88320%40postgrespro.ru > [1] https://postgr.es/m/057a9a95-19d2-05f0-17e2-f46ff20e9b3e%402ndquadrant.com > I'm glad my idea has been reborn. Well, may be simplehash is not bad idea. While it certainly consumes more memory and CPU instructions. I'll try to review. regards, Yura Sokolov

jff: checksum algorithm is not as intended

2021-08-29 Thread Yura Sokolov
327ff01) (where mix is a `__tmp` to `checksum` transformation) regards, Yura Sokolov y.soko...@postgrespro.ru funny.fal...@gmail.com PS. Test program in Crystal language is attached and output for current CHECKSUM_COMP implementation and "correct" (intended). Excuse me for Crystal,

Avoid dynahash's freelist in BufferAlloc.

2021-09-22 Thread Yura Sokolov
.soko...@postgrespro.ru funny.fal...@gmail.com From 2afbc5a59c3ccd3fec14105aff40252eeaacf40c Mon Sep 17 00:00:00 2001 From: Yura Sokolov Date: Wed, 22 Sep 2021 13:10:37 +0300 Subject: [PATCH] More gentle dynahash usage in buffer allocation. When BufferAlloc reuses some valid buffer, there i

BufferAlloc: don't take two simultaneous locks

2021-10-01 Thread Yura Sokolov
for link to next and hashvalue. regards, Yura Sokolov y.soko...@postgrespro.ru funny.fal...@gmail.com From a1606eaa124fc497763ed5e28e22cbc8f6443b33 Mon Sep 17 00:00:00 2001 From: Yura Sokolov Date: Wed, 22 Sep 2021 13:10:37 +0300 Subject: [PATCH v0] bufmgr: do not acquire two partition locks. Acquir

Re: BufferAlloc: don't take two simultaneous locks

2021-10-03 Thread Yura Sokolov
В Пт, 01/10/2021 в 15:46 -0700, Zhihong Yu wrote: > > > On Fri, Oct 1, 2021 at 3:26 PM Yura Sokolov > wrote: > > Good day. > > > > I found some opportunity in Buffer Manager code in BufferAlloc > > function: > > - When valid buffer is evicted, Buff

  1   2   >