Re: Row pattern recognition

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: assam258(at)gmail(dot)com
Cc: Tatsuo Ishii <ishii(at)postgresql(dot)org>, zsolt(dot)parragi(at)percona(dot)com, sjjang112233(at)gmail(dot)com, vik(at)postgresfriends(dot)org, er(at)xs4all(dot)nl, jacob(dot)champion(at)enterprisedb(dot)com, david(dot)g(dot)johnston(at)gmail(dot)com, peter(at)eisentraut(dot)org, li(dot)evan(dot)chao(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Row pattern recognition
Date: 2026-10-13 03:40:29
Message-ID: CACJufxGxfpHnr1a0iu0K3kKoxw7A8cot5POYnYVw+64Q7JDHow@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.

I always want to get rid of WindowAggState.nfaStateSize. It's ugly.

nfa_state_clone->nfa_state_make is hot path, but
ExecRPRStartContext->nfa_state_make is not.

In nfa_state_clone->nfa_state_make:
memset(state, 0, winstate->nfaStateSize)
is waste cycle, because nfa_state_clone would unconditionally memcpy
from (int32 *counts) later.

With that, we can get rid of memset in nfa_state_make conditionally,
once memset is removed, nfaStateSize is no longer needed.

Most of the row pattern code already works on WindowAggState, so
refactoring makes the remaining rpr routines take WindowAggState instead of
WindowObject as well. This looks more consistent.

based on https://github.com/assam258-5892/postgres/tree/RPR-20260930

--
jian
https://www.enterprisedb.com/

Attachment Content-Type Size
v54-0003-Remove-WindowAggState.nfaStateSize.txt text/plain 6.5 KB
v54-0001-Use-WindowAggState-instead-of-WindowObject-in-rpr-routines.txt text/plain 5.4 KB
v54-0002-minor-using-palloc0_array-instead-of-palloc0.txt text/plain 1.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shihao zhong 2026-10-13 03:50:08 [PG19] btree_gin misses rows for a timestamptz bound in the repeated DST hour
Previous Message shihao zhong 2026-10-13 03:35:39 [PG19] Eager aggregation runs a volatile join clause once per group