Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gyEVc-0003pP-Uf for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Feb 2019 11:33:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gyEVa-000571-Ed for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Feb 2019 11:33:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gyEVa-00056u-7J for pgsql-hackers@lists.postgresql.org; Mon, 25 Feb 2019 11:33:18 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gyEVT-0002hb-Gu for pgsql-hackers@postgresql.org; Mon, 25 Feb 2019 11:33:17 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id E4C5E21C69BF; Mon, 25 Feb 2019 14:33:10 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.27.237] (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 84A7E21C65B7; Mon, 25 Feb 2019 14:33:10 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1551094390; bh=5Zqj7wIHK4rh2MCOYMCbJO5CIvXIMEl0naISTlYfXXA=; h=From:Subject:To:Cc:References:Date:In-Reply-To; b=g0JqWfo1IDzEFC0BcT8eMnJ8zSzVs7IIuStINMBchSbHK4+7Sk5rLm3UMUe3NYp6n go8Pfk3QSKyUh+9OH0Y6AjqrmpkcxnkgA9ziTcTtlG4KelGRokJLoBNTsLLEw/T9DP 1CWs/IrRpGVcVN401UPP3TggJc9Gb72G24Cp4Vfc= From: Arthur Zakirov Subject: Re: [PROPOSAL] Shared Ispell dictionaries To: Robert Haas Cc: Tomas Vondra , Andres Freund , Tom Lane , Pavel Stehule , pgsql-hackers References: <27296.1522078068@sss.pgh.pa.us> <20180614084015.GA12451@zakirov.localdomain> <20181001092204.GA5071@zakirov.localdomain> <68aaaff6-0efe-c14b-7aee-fb110bb97f69@2ndquadrant.com> <337f7a55-58b8-4fcc-a933-5e7799fa6882@postgrespro.ru> <42b1ded6-fd44-5975-77e4-72ada1f134a2@2ndquadrant.com> <20190120222121.ehistvcr4wsu2su5@alap3.anarazel.de> <95aea959-97a1-2ded-c881-eede4e5a1f0c@2ndquadrant.com> <5113daa6-b6e7-59f6-c4a8-96b5b81474fb@postgrespro.ru> <1932084f-167a-8893-be24-c4c06afe113b@2ndquadrant.com> <26e59c3b-3598-cc2c-6b8d-81d24d6d0930@postgrespro.ru> <4c321cb7-899f-0548-ecf4-5e965dd71335@postgrespro.ru> Message-ID: <5902bb0c-b3aa-acc4-4324-e33735c4e5a8@postgrespro.ru> Date: Mon, 25 Feb 2019 14:33:10 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 21.02.2019 19:13, Robert Haas wrote: > So I think it's better to have each backend locally make a decision > about when that particular backend no longer needs the dictionary, and > then let the system automatically clean up the ones that are needed by > nobody. Yep, it wouldn't be hard to implement. > Perhaps a better approach still would be to do what Andres proposed > back in March: > > #> Is there any chance we can instead can convert dictionaries into a form > #> we can just mmap() into memory? That'd scale a lot higher and more > #> dynamicallly? > > The current approach inherently involves double-buffering: you've got > the filesystem cache containing the data read from disk, and then the > DSM containing the converted form of the data. Having something that > you could just mmap() would avoid that, plus it would become a lot > less critical to keep the mappings around. You could probably just > have individual queries mmap() it for as long as they need it and then > tear out the mapping when they finish executing; keeping the mappings > across queries likely wouldn't be too important in this case. > > The downside is that you'd probably need to teach resowner.c about > mappings created via mmap() so that you don't leak mappings on an > abort, but that's probably not a crazy difficult problem. It seems to me Tom and Andres also vote for the mmap() approach. I think I need to look closely at the mmap(). I've labeled the patch as 'v13'. -- Arthur Zakirov Postgres Professional: http://www.postgrespro.com Russian Postgres Company