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 1q0hY0-00006y-W4 for pgsql-general@arkaria.postgresql.org; Sun, 21 May 2023 11:48:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q0hG8-0003fe-Hb for pgsql-general@arkaria.postgresql.org; Sun, 21 May 2023 11:29:56 +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 1q0hG8-0003fR-2W for pgsql-general@lists.postgresql.org; Sun, 21 May 2023 11:29:56 +0000 Received: from mail-qv1-xf2b.google.com ([2607:f8b0:4864:20::f2b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1q0hG4-0019mI-Eu for pgsql-general@lists.postgresql.org; Sun, 21 May 2023 11:29:55 +0000 Received: by mail-qv1-xf2b.google.com with SMTP id 6a1803df08f44-62388997422so21075376d6.1 for ; Sun, 21 May 2023 04:29:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wi3ck-info.20221208.gappssmtp.com; s=20221208; t=1684668469; x=1687260469; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=hnER5voEu0ksscxrbwkD1oyfYt73fGILhcn2+Ny15QU=; b=n3uztxBGJcbrH2KbkAkvW/Wz+zUC7VTg7U6nxE+jFKU8PRjRRy23rnls79T0vnX1by p4Lk5iKBe0SBuMKPM1qwYupAF48JpjXgFrRABj5s+N/lJTZ6Q8cRLetgS/Ja3Y+W8PAM d/wZlVmGMzBuEds18txzmEr6XcbwArzchmDUtJZ6DRMCtfDS6oFkioUDltEIU5qTT0It qS3Oz5TtYI/VKn5sYi+mD4ufRIsGplalMJYToAwck22PlQUUj6tIdMXSXZwXehjmltQa nMTXuXmKB4pbjuD22c1Arn+j+adr8WZiOntlvMbE6kmv6lU0EPxEZ6Vw/q8+qyy0iYgc 1W2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684668469; x=1687260469; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hnER5voEu0ksscxrbwkD1oyfYt73fGILhcn2+Ny15QU=; b=VpkWvEa7NqRux6xHjgSO1ySNM5u5vZVnmPg4z8VrLkb37WYLv402QtaiS7qb0MSuvl l28fm/uGci02bxg/aS9vLP3LcfxWEW3lnzc8VHk5ROzLxcgtUJGzWslCql0we4CY5PZL pT5Enx0sJZvpKFz13lGHMMWAl8nEKVe3Ln++0mlthY1TsE3E2FRX5rzJV50H3vWuFBEs cOP859AuRUztj05GajBUnrrKlyEt3Jcxb1ARRoRkdNzhMlswMrd/DVeQpOJL77txiYUJ Kf9ylOOP7G+ZPNUhSa0dmubYazfvtAGokJRCLxOqZSh/ZB8yCJ6q4BHqsEp67OMdbyag 0eJg== X-Gm-Message-State: AC+VfDy3IbeM2+z6xBBmpU/Edlzx9rjbRVH2FaCqIY0GXx2k69DmTVW1 +gWMOQ/FNTNqDV0HYAk/Z3oPig== X-Google-Smtp-Source: ACHHUZ63C+0dvOY3ikevmWO0CytP6bsSvo/BOh3YJGYBbDfclOkX/3enlqedpErLDqg39LthAafsag== X-Received: by 2002:a05:6214:2466:b0:621:42c8:9bdd with SMTP id im6-20020a056214246600b0062142c89bddmr16861577qvb.29.1684668469533; Sun, 21 May 2023 04:27:49 -0700 (PDT) Received: from [172.21.0.10] (pool-173-49-58-32.phlapa.fios.verizon.net. [173.49.58.32]) by smtp.gmail.com with ESMTPSA id jh20-20020a0562141fd400b0061b583b143esm1206186qvb.37.2023.05.21.04.27.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 21 May 2023 04:27:49 -0700 (PDT) Message-ID: Date: Sun, 21 May 2023 07:27:47 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: Profiling a function call Content-Language: en-US To: Tiffany Thang , "pgsql-generallists.postgresql.org" References: From: Jan Wieck In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 5/20/23 00:36, Tiffany Thang wrote: > Hi, > I have a function that has been executing for a long time and not > returning any results. Wait event=NULL so it seems like it is still > executing and not waiting on any specific resources. Is there a way to > profile the function call to get an idea of what it is currently > executing within the function? All I could find in pg_stat_activity is > the function is running. I want to know what query/transaction within > the function is running. Is there a way to obtain that information? This may give you some idea. I haven't touched or used it in many years, but it might get you started: https://github.com/wieck/plbacktrace Best Regards, Jan > > PostgreSQL 15.2 on Linux. > > Thanks. > > Tiff