Re: reducing the footprint of ScanKeyword (was Re: Large writable variables)
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: John Naylor <jcnaylor@gmail.com>, pgsql-hackers@postgresql.org
Date: 2018-12-22T18:14:20Z
Lists: pgsql-hackers
Hi, On 2018-12-22 12:20:00 -0500, Tom Lane wrote: > John Naylor <jcnaylor@gmail.com> writes: > > Using a single file also gave me another idea: Take value and category > > out of ScanKeyword, and replace them with an index into another array > > containing those, which will only be accessed in the event of a hit. > > That would shrink ScanKeyword to 4 bytes (offset, index), further > > increasing locality of reference. Might not be worth it, but I can try > > it after moving on to the core scanner. > > I like that idea a *lot*, actually, because it offers the opportunity > to decouple this mechanism from all assumptions about what the > auxiliary data for a keyword is. OTOH, it doubles or triples the number of cachelines accessed when encountering a keyword. The fraction of keywords to not-keywords in SQL makes me wonder whether that makes it a good deal. Greetings, Andres Freund
Commits
-
Use perfect hashing, instead of binary search, for keyword lookup.
- c64d0cd5ce24 12.0 landed
-
Reduce the size of the fmgr_builtin_oid_index[] array.
- 8ff5f824dca7 12.0 landed
-
Replace the data structure used for keyword lookup.
- afb0d0712f1a 12.0 landed