Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mYiKw-0005ot-9K for pgsql-performance@arkaria.postgresql.org; Fri, 08 Oct 2021 05:22:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mYiKt-0002Ij-NH for pgsql-performance@arkaria.postgresql.org; Fri, 08 Oct 2021 05:22:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mYiKt-0002IZ-6s for pgsql-performance@lists.postgresql.org; Fri, 08 Oct 2021 05:22:23 +0000 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mYiKp-0002F9-JH for pgsql-performance@lists.postgresql.org; Fri, 08 Oct 2021 05:22:22 +0000 Received: by mail-pf1-x435.google.com with SMTP id m26so7227342pff.3 for ; Thu, 07 Oct 2021 22:22:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ardentperf-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=VTSzApX47KzUUO18IpcuYVuBEYBmoRyIlJ16EewARkg=; b=Asvv3/zit6GgWHU1AKgsAOxJMuH87SrghNDTtzRNvHX+01zXomACxjPxoOPxv/WJPc 1/M6ky/VFeYF3yajRCpPIWRMAY+VZyAYIr0vKLeRH840mGRMSK9svCFeQOpm3jOhYpiz skA+BFXXI9zEVwji0waVoOrFVVmeIi9tCaT8MOIhiuS9wk6TKu88yxJnIb6nvLRz1uDD uFohryUJ8KVgJAfyBnSk1nq4jg1F0WnKu3vbZJhlvQho6OywSE4iJi58swC+UhlE/h08 BX06AFnaFKzx+7mQbSYB1yp69nAUTN2Ir7+BxqIgjfDvsoQaTD4Pt4Qycsm9isxpdiwv rRoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=VTSzApX47KzUUO18IpcuYVuBEYBmoRyIlJ16EewARkg=; b=7IqaI4M20R9XlnITVN2Xy985URmzpVIgXBo7/3Ke1gYtHRSKfiM8mGx64xbfpdlJtU 0lA/wh91LhvQitJ7v2oGLxK9lC5A1hmeHifb/nXsc+BjBBB6chcPxqSHoJIMVcVCJcll q2IWQAWX3189s2x+uqk5mVbrHbGfD5jsYzh+gfqxOOd9Df32x6/ESO0WPQuPUgWA8KaU KKEgM9+NxoGH05524ZDkN8PomZzTDMXBCPjc+7L7GG04ZR/vn0Vw1AsZLQgalR1vqsA2 4iqW4Ckwb6Nq6Obtvc0YkP/kfJPCvd9hSLEXmiNFWhL9XKeV4MkQYXseM1ap2vH49RRY G21w== X-Gm-Message-State: AOAM532PIYR5J5++2lb+7NrNWkJ+stwPFp+WeKST1ihf7Bz6m0mxJ/T3 ru7lkeA1e7bh6Aa12562L4Lx6g== X-Google-Smtp-Source: ABdhPJyRxpbxNCb7SwZrj2o362X/JgnDw5QTgZvdPQtAHcvtbsa2LOO9pXtO5Q68/kRLtcFOQSk8cw== X-Received: by 2002:a62:77d8:0:b0:44c:8618:1bed with SMTP id s207-20020a6277d8000000b0044c86181bedmr8431573pfc.27.1633670536863; Thu, 07 Oct 2021 22:22:16 -0700 (PDT) Received: from smtpclient.apple (c-24-17-46-25.hsd1.wa.comcast.net. [24.17.46.25]) by smtp.gmail.com with ESMTPSA id s4sm1051361pfw.182.2021.10.07.22.22.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Oct 2021 22:22:16 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Jeremy Schneider Mime-Version: 1.0 (1.0) Subject: Re: Better, consistent instrumentation for postgreSQL using a similar API as Oracle Date: Thu, 7 Oct 2021 22:22:12 -0700 Message-Id: References: <20211008023849.GF5476@momjian.us> Cc: Peter Geoghegan , Jeff Holt , pgsql-performance@lists.postgresql.org, Laurenz Albe In-Reply-To: <20211008023849.GF5476@momjian.us> To: Bruce Momjian X-Mailer: iPhone Mail (18H17) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Oct 7, 2021, at 19:38, Bruce Momjian wrote: >=20 > =EF=BB=BFOn Thu, Oct 7, 2021 at 07:15:39PM -0700, Jeremy Schneider wrote:= >> PostgreSQL added wait events starting in 9.6 and the last thing that's >> missing is an integrated way to trace or log them. A simple starting >> point could be a session-level GUC that enables a hook in >> pgstat_report_wait_start() and pgstat_report_wait_end() to just drop >> messages in the log. These log messages could then easily be processed >> to generate the similar profiles to the ones we used with other >> databases. Basically I agree 100% with Jeff that while you can do these >> things with perf probes or eBPF, there are massive advantages to having >> it baked in the database. With the right tools, this makes session >> profiling available to regular users (who do their day jobs with excel >> rather than eBPF). >=20 > Our wait events reported in pg_stat_activity are really only a first > step --- I always felt it needed an external tool to efficiently collect > and report those wait events. I don't think the server log is the right > place to collect them. What would you think about adding hooks to the functions I mentioned, if som= eone wrote an open source extension that could do things with the wait event= start/stop times in a preload library? But we could use parameters too, that=E2=80=99s another gap. For example - w= hich buffer, object, etc for buffer_content? Which filenode and block for an= IO? Which relation OID for a SQL lock? Then you can find which table, wheth= er the hot block is a root or leaf of a btree, etc. This can be done by exte= nding the wait infra to accept two or three arbitrary =E2=80=9Cinformational= =E2=80=9D parameters, maybe just numeric for efficiency, or maybe string, an= d each individual wait event can decide what to do with them. We=E2=80=99d w= ant to pass that info out over the hooks too. This is another reason to supp= ort wait event tracing in the DB - sometimes it might be difficult to get al= l the relevant context with a kernel probe on an external tool. -Jeremy Sent from my TI-83