Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qzCOM-00EWQ9-9l for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Nov 2023 08:52:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qzCOJ-005OvY-8E for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Nov 2023 08:52:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qzCOI-005OvP-Hh for pgsql-hackers@lists.postgresql.org; Sat, 04 Nov 2023 08:52:26 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qzCOF-003tqs-KK for pgsql-hackers@lists.postgresql.org; Sat, 04 Nov 2023 08:52:25 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-507a62d4788so3724512e87.0 for ; Sat, 04 Nov 2023 01:52:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699087941; x=1699692741; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=/gyV+LgPIH6YBUjTJgGUTkqT/xFmblgmlwP3U+H7MWU=; b=I3KO+3n4np5URRjVXo7cDBsXfGCHQlkzjzD58w9SRKewUDxbAUf6oTQzFevaIYCZdW OQz2X7XcNuawVtREM+sMdwqakH28p9o5QKksx1UXLWqHRJj9IFnPJOFmzfCDSbxiM3IU gW6ofSYCc5m/upgmnsB5ZYrXMJeLhNO6iYstqOk2qQJSuhILV3idjS3X8BO3VZvDs52e 0kE0sof5edfUcQ9JWaCCm2eBUWTDwqi+KC+1gcXgw1MH6xNGXm8IUrGTyHslWXDq1SS+ UsD6qSuNj/LOs+xgTNmJcofAovLjcnwYAD1puK9CTzGtS7EXReOlzoj0sqQ9/FObqQH3 S4+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699087941; x=1699692741; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/gyV+LgPIH6YBUjTJgGUTkqT/xFmblgmlwP3U+H7MWU=; b=Evt+g7rkr3hhAF0MTOQ77wgVQfMByHl/OJmIIXvYOTHbR9BFfklD4FoySDYJsMwCCS GRaWm9qxbOfErUoSzPN8CAawIpIxHtrKE1Iuz4OSHdY1APhicyjk7SjK9oOihWe+MGag r3jF4x/iUtWTiqBm6tF0OLZiFhocIfzFPJXpwIf+DW2b3Yb7oCp3xx2ywIASmfa+pXVB uifemBCMjC5xNB3Y8/bJqQZ+fO0xgGb4/lFJP8QHnZqfk39GwJm/3vQ69ivKzYDgG4nm /S1ofgy5bEgfqFYH1DN1f7Gnh4PoYELZBTdVa10ceaip3rhEVSOsykzr3gVs51K72RGK H9Jw== X-Gm-Message-State: AOJu0Yzf5eAAsTvvAFJjh5GOp6cWhsnfkB04Nh2QmRRKrsUXHASwnJhI aWOH5MG19HmbKGKzFEx0sfCNhxwzUffQz56UaxM= X-Google-Smtp-Source: AGHT+IHH+mcVWXrOUmbz8dSVxR/zGTh38Oqbw13myRpIyvLGR9QQKEEw4scUAJTnyNOHRTVlthhbx8H4B5nlX5MlZfI= X-Received: by 2002:ac2:5a51:0:b0:508:12f4:34dc with SMTP id r17-20020ac25a51000000b0050812f434dcmr16966747lfn.42.1699087940479; Sat, 04 Nov 2023 01:52:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Dilip Kumar Date: Sat, 4 Nov 2023 14:22:01 +0530 Message-ID: Subject: Re: Parallel Bitmap Heap Scan reports per-worker stats in EXPLAIN ANALYZE To: David Geier Cc: PostgreSQL Developers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jan 20, 2023 at 2:04=E2=80=AFPM David Geier w= rote: > > Hi hackers, > > EXPLAIN ANALYZE for parallel Bitmap Heap Scans currently only reports > the number of heap blocks processed by the leader. It's missing the > per-worker stats. The attached patch adds that functionality in the > spirit of e.g. Sort or Memoize. Here is a simple test case and the > EXPLAIN ANALYZE output with and without the patch: > > With the patch: > > Gather (actual rows=3D99501 loops=3D1) > Workers Planned: 2 > Workers Launched: 2 > -> Parallel Bitmap Heap Scan on foo (actual rows=3D33167 loops=3D3) > Recheck Cond: ((col0 > 900) OR (col1 =3D 1)) > Heap Blocks: exact=3D98 > Worker 0: Heap Blocks: exact=3D171 lossy=3D0 > Worker 1: Heap Blocks: exact=3D172 lossy=3D0 else { + if (planstate->stats.exact_pages > 0) + appendStringInfo(es->str, " exact=3D%ld", planstate->stats.exact_pages= ); + if (planstate->stats.lossy_pages > 0) + appendStringInfo(es->str, " lossy=3D%ld", planstate->stats.lossy_pages); appendStringInfoChar(es->str, '\n'); } } .... + for (int n =3D 0; n < planstate->shared_info->num_workers; n++) + { .... + "Heap Blocks: exact=3D"UINT64_FORMAT" lossy=3D" INT64_FORMAT"\n", + si->exact_pages, si->lossy_pages); Shouldn't we use the same format for reporting exact and lossy pages for the actual backend and the worker? I mean here for the backend you are showing lossy pages only if it is > 0 whereas for workers we are showing 0 lossy pages as well. --=20 Regards, Dilip Kumar EnterpriseDB: http://www.enterprisedb.com