Re: reducing the footprint of ScanKeyword (was Re: Large writable variables)
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joerg Sonnenberger <joerg@bec.de>
Cc: David Rowley <david.rowley@2ndquadrant.com>,
John Naylor <jcnaylor@gmail.com>, Andres Freund <andres@anarazel.de>,
PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2019-01-06T22:08:59Z
Lists: pgsql-hackers
Joerg Sonnenberger <joerg@bec.de> writes: > On Sun, Jan 06, 2019 at 02:29:05PM -0500, Tom Lane wrote: >> * We should extend the ScanKeywordList representation to include a >> field holding the longest keyword length in the table, which >> gen_keywordlist.pl would have no trouble providing. Then we could >> skip downcasing and/or hashing for any word longer than that, replacing >> the current NAMEDATALEN test, and thereby putting a tight bound on >> the cost of downcasing and/or hashing. > Correct, possibly even have an array for each class of keywords. I added that change to v8 and noted a further small improvement in my test case. That probably says something about the prevalence of long identifiers in information_schema.sql ;-), but anyway we can figure it's not a net loss. I've pushed that version (v8 + max_kw_len); if the buildfarm doesn't fall over, we can move on with looking at hashing. I took a quick look through the NetBSD nbperf sources at http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/nbperf/ and I concur with your judgment that we could manage translating that into Perl, especially if we only implement the parts we need. I'm curious what further changes you've made locally, and what parameters you were using. regards, tom lane
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