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 1hpbFT-0004OK-Dx for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Jul 2019 16:33:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hpbFR-0008Ms-66 for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Jul 2019 16:33:13 +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 1hpbFQ-0008Ml-PS for pgsql-hackers@lists.postgresql.org; Mon, 22 Jul 2019 16:33:12 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hpbFM-0001Tx-Mm for pgsql-hackers@postgresql.org; Mon, 22 Jul 2019 16:33:12 +0000 Received: by mail-pf1-x443.google.com with SMTP id c73so17618065pfb.13 for ; Mon, 22 Jul 2019 09:33:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=DF/sm5RYouH0Oiq/89gva0p1epzLvEPt9HX1b7TxVMo=; b=uVwELC0TvbEpt6ivs/wRrwGQwI9R9xwRgLVvRup/py6pZWTuFD9VJbWDQ4vgtUXkg8 kolrU/niuPOml/kw8ftw/cxEhUaAQMrI1jBi5feZe99ho2tz94x2L/3Yn3qcP1lxWNgX FTyGVR10MBMei20ctw/VU45Lb5cqT+nKLv5atWMNDRs0CRdBeWHA8haL6XqUIY5ZHKbJ Adm49c/Ax/7wWvi4gzqWLDLqyL+ylGDG7CInyosjCdElEwDRrn/eGJ94zzMXhnMd0iDM qXRjsVUf3OsPqtWCpJUo3Irr1hhtysxhHXss4C5TsENWfWZckqgzvD22HjJ3G3zPcj/I H52A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=DF/sm5RYouH0Oiq/89gva0p1epzLvEPt9HX1b7TxVMo=; b=UwA0w8HSYhs+HDt5clT7I3fcjHO7druGHelBNtDLDdTjwE6D+RgiDh+44Cnn1957Sv iet8KjMbKqg9RsA6/Cd5UK8OZa/99Nn10dL7CX6eFOE0LkNNmfiEC4PSRLd1JvWq1J1w TJH6rWEpiVuEOmsd6bMurFdfo/LMgGsPr96RB+ukDwYpNkBkoO5B1AUN4W4EYLj2Yn+q V5qxBZcru+x3Qyfa4tw2JliLPXrVPjbNW7G3Ay/0vGM+tSzHuFXzWLLByNdTaUh0qpuG kAsHGMfvMCvCSOO51bk51zPRHAQvBwV1uIKfZw75rPccnqrkGzSYl9lsOqf0iomC0Be4 1c2Q== X-Gm-Message-State: APjAAAVmtCgkM9PSJ4GasjwRvKgRNWlGpjmd90MH6IRHm9VqpMxFL4oX dGINX8wFCWtkEoqgwoszhYY= X-Google-Smtp-Source: APXvYqwnGNVSiSpZUUrDNdpdq17bBq8AnuskXN/zo5De07JW89o9qWO4haMEdkKIhO0wb71jLA4CeA== X-Received: by 2002:a63:5048:: with SMTP id q8mr71563635pgl.446.1563813184746; Mon, 22 Jul 2019 09:33:04 -0700 (PDT) Received: from jdavis ([2600:1010:b046:daa6:6928:26cf:9e29:4c86]) by smtp.gmail.com with ESMTPSA id o14sm33028212pjp.19.2019.07.22.09.33.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jul 2019 09:33:04 -0700 (PDT) Message-ID: <176131d7f021b58cb1421ccdde4d192f7703e9ce.camel@j-davis.com> Subject: Re: Memory Accounting From: Jeff Davis To: Tomas Vondra , Heikki Linnakangas Cc: pgsql-hackers@postgresql.org Date: Mon, 22 Jul 2019 09:33:03 -0700 In-Reply-To: <20190722161658.ryo6lbgead2tijew@development> References: <027a129b8525601c6a680d27ce3a7172dab61aab.camel@j-davis.com> <8456dbe6-2245-6a6d-03af-bb62d1615782@iki.fi> <20190722161658.ryo6lbgead2tijew@development> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, 2019-07-22 at 18:16 +0200, Tomas Vondra wrote: > * I changed it to only update mem_allocated for the current > > > context, > > > not recursively for all parent contexts. It's now up to the > > > function > > > that reports memory usage to recurse or not (as needed). > > > > Is that OK for memory bounded hash aggregation? Might there be a > > lot > > of sub-contexts during hash aggregation? > > > > There shouldn't be, at least not since b419865a814abbc. There might > be > cases where custom aggregates still do that, but I think that's > simply a > design we should discourage. Right, I don't think memory-context-per-group is something we should optimize for. Discussion: https://www.postgresql.org/message-id/3839201.Nfa2RvcheX%40techfox.foxi https://www.postgresql.org/message-id/5334D7A5.2000907%40fuzzy.cz Commit link: https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=b419865a814abbca12bdd6eef6a3d5ed67f432e1 Regards, Jeff Davis