From 18f7f3920983d5bd1172daf4cd888e147aef190c Mon Sep 17 00:00:00 2001 From: Tomas Vondra Date: Wed, 16 Jan 2019 00:03:13 +0100 Subject: [PATCH 7/7] Store ispell in shared location tweaks --- doc/src/sgml/textsearch.sgml | 18 ++++++++++-------- src/backend/tsearch/dict_ispell.c | 2 ++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/doc/src/sgml/textsearch.sgml b/doc/src/sgml/textsearch.sgml index 0f172eda04..8cceef3aa7 100644 --- a/doc/src/sgml/textsearch.sgml +++ b/doc/src/sgml/textsearch.sgml @@ -3114,14 +3114,16 @@ CREATE TEXT SEARCH DICTIONARY english_stem ( Dictionaries in Shared Memory - Some dictionaries, especially Ispell, consumes - a significant amount of memory, in some cases tens of megabytes. Most of - them store the data in text files, and building the in-memory structure is - both CPU and time-consuming. Instead of doing this in each backend when - it needs a dictionary for the first time, the compiled dictionary may be - stored in dynamic shared memory so that it may be reused by other backends. - Currently only Ispell supports loading into - dynamic shared memory. + Dictionaries, especially Ispell, may be quite + expensive both in terms of memory and CPU usage. For large dictionaries + it may take multiple seconds to read and process input text files on first + access, and the in-memory representation may require tens of megabytes. + When each backend processes the dictionaries independently and stores them + in private memory, this cost is significant. To amortize it, the compiled + dictionary may be stored in shared memory for reuse by other backends. + Currently only Ispell supports such sharing. + + XXX "supported" is not the same as "all ispell dicts behave like that". diff --git a/src/backend/tsearch/dict_ispell.c b/src/backend/tsearch/dict_ispell.c index 3c9dd78c56..ae2463e2dc 100644 --- a/src/backend/tsearch/dict_ispell.c +++ b/src/backend/tsearch/dict_ispell.c @@ -9,6 +9,8 @@ * of memory exceeds max_shared_dictionaries_size, then the dictionary will be * allocated in private backend memory (in dictCtx context). * + * XXX There's no max_shared_dictionaries_size anymore. + * * All necessary data are built within dispell_build() function. But * structures for regular expressions are compiled on first demand and * stored using AffixReg array. It is because regex_t and Regis cannot be -- 2.17.2