Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eOS1j-00066p-Ro for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Dec 2017 17:38:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eOS1j-00030k-FZ for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Dec 2017 17:38:03 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eOS1j-00030W-32 for pgsql-hackers@lists.postgresql.org; Mon, 11 Dec 2017 17:38:03 +0000 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eOS1g-0001jk-5H for pgsql-hackers@lists.postgresql.org; Mon, 11 Dec 2017 17:38:01 +0000 Received: by mail-wm0-x22f.google.com with SMTP id f9so15748110wmh.0 for ; Mon, 11 Dec 2017 09:37:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=1cyAZ4LTZIXqiS05PuDgCty8GxSpCS6uiZXd42aikGI=; b=GjBTKDb6Y1jhm05PZF47dOSwR7TidVAMkTQryK6cL6En4MstYiOq/SATTQlQlZoTck aLAEg5KDKPhibpx4OZTfCc9AvshJDjqi8PsivfsCHdnB7YMZlIdgRa59C9bsYrfLRGrq 3wUGQdpJQWICkB0muXVG0yFApJxpOjvzY/mlFiMcOT4Pa2mWYHHDSHTGMLlBi8xTtWlo 2LkYxDLy5IfuPVjnGyMSDoxTr2YLaqaqnq5SS2n4eMMPEwS0dbbYp8OeiP3Gl6DFFMqy nT7E1/33xcHfBxouwp+6166PJeAaibljW6uiM6XIWKhxatojkvJ1a9uQYKbxAGTLtOpJ Cdkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1cyAZ4LTZIXqiS05PuDgCty8GxSpCS6uiZXd42aikGI=; b=jkU+ONdSZ8LYNdwpqUUM6Umw9bmOjvpBUuMNR4uyA6+iZb2AyoH7mqyisF6I9JTmsY bFiDW9o/HT6od4mJR0J9vC+8XlP/EKMJfDzkTwQ2oj0NwC6mqKc6xUqAxaB3mNG8GzKr PgDAI7PLPZ/xoBTxNa4nAXXksmQWh0YeZmhs1vX6iful7etZw+Op+T3cKSyaoBHKC4mj N9PnwATv6STtR+uiYkcL41et0jvwofbYw+gWhAv8DgshObaqyfC50KTTvxe5CMfP8Y6l Vq4ViQURio++BfgLa4R9irnIykSF7GFyRegUhpgERu2slimqYXNygp9pYUhr6N2COJW8 KbOA== X-Gm-Message-State: AKGB3mLeW+GbGyd3WiOkyr8Bt8WvjsVQ57EqY1w5Q1iaz27/9OBY6XwF OBDbCFMGoO+gJRGI9LPXD/A+wFRYofHcE26p5tdphjuMcZ5iJ1lX2NzHdCqIFqMIjf7H1xAiUJL rcfFz/QYw225ApCnhT4HCycHqk3qISRgLGO+MbaysawHM/YS7k8VgGAFLggq/e0ohhQYVPMkJHn JJzVwaDtcTbphS1L56 X-Google-Smtp-Source: ACJfBot0rhkA5H2Js89BhZRD4ee7TKGn7nQ6o54YBp35oh2E7hTTeveTV6j0Uyt86MdeeeZpwahaKw== X-Received: by 10.28.108.11 with SMTP id h11mr1495806wmc.28.1513013877437; Mon, 11 Dec 2017 09:37:57 -0800 (PST) Received: from [10.137.2.19] (ip-78-102-97-226.net.upcbroadband.cz. [78.102.97.226]) by smtp.gmail.com with ESMTPSA id z5sm1368315wre.77.2017.12.11.09.37.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2017 09:37:56 -0800 (PST) Subject: Re: Rethinking MemoryContext creation To: Robert Haas , Tom Lane Cc: pgsql-hackers@lists.postgresql.org References: <2264.1512870796@sss.pgh.pa.us> <9726.1513009650@sss.pgh.pa.us> <12544.1513011559@sss.pgh.pa.us> From: Tomas Vondra Message-ID: <7fb9afdb-c694-16a3-157b-bd890be9dcc7@2ndquadrant.com> Date: Mon, 11 Dec 2017 18:37:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/11/2017 06:22 PM, Robert Haas wrote: > On Mon, Dec 11, 2017 at 11:59 AM, Tom Lane wrote: >> Tomas Vondra writes: >>> On 12/11/2017 05:27 PM, Tom Lane wrote: >>>> However, unless we want to run around and touch all the ~ 150 calls >>>> with constant arguments, we'd have to set things up so that the default >>>> behavior for AllocSetContextCreate is to not copy. This risks breaking >>>> callers in extensions. Not entirely sure if it's worth that --- any >>>> thoughts? >> >>> I don't think silently breaking extensions is particularly attractive >>> option, so I guess we'll have to run around and tweak the ~150 calls. >> >> Meh. I suppose that of the ~150 call sites, there are probably only >> a dozen or two where it would actually make a performance difference, >> so maybe this needn't be quite as invasive as I first thought. > > I think changing only a subset of the call sites is unappealing > because, even though it may not make a measurable performance > difference in other cases, it may get cargo-culted into some place > where it does make a difference. > Not sure. One the one hand, it might certainly be somewhat confusing when we use two different methods to create memory contexts with C string constants. On the other hand, I'm sure we have other similar "local" optimizations. I'd say "let's just tweak all the calls to use the new function" but I'm not the person doing the leg work ... > I also don't think silently breaking extensions is a terribly big deal > in this case. It seems likely that most extensions use static names > just as most of our internal stuff does. I'm going to guess that the > number of extensions that will actually break as a result of a change > in this area is probably very small - conceivably zero, and likely > less than five. I don't think we should be willing to uglify the core > code too much for that level of breakage. > I don't know how many extensions you maintain, but in my experience this type of silent breakage is extremely annoying. I definitely prefer a clean compile-time API breakage, for example. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services