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 1tk1ya-00GRua-JQ for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Feb 2025 14:20:00 +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 1tk1yZ-00GJrq-AC for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Feb 2025 14:19:59 +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 1tk1yZ-00GJri-0a for pgsql-hackers@lists.postgresql.org; Mon, 17 Feb 2025 14:19:59 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tk1yX-001JRI-0z for pgsql-hackers@lists.postgresql.org; Mon, 17 Feb 2025 14:19:58 +0000 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-ab771575040so1069579866b.1 for ; Mon, 17 Feb 2025 06:19:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739801995; x=1740406795; 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=fFwoen2n6A3xEmQGO9XWd+wlPy573IpuepvIjETX2XU=; b=Cv/TICUXeMF2rh5aBct3g7go+lnbkvr4Flj84tBWnyZcFq6/iGQ9Cj5N4XQl7eR91C YRtAQ2lNdaiSUHTw7yL/ifGhUjQuZ6qjGXdEs/xLYqucYeIMzqETkmyiD4DzdqYF683f dHTd9XgqTdprM4f/W7QUfNLOAX4aF7fgpJMOqV3+rFLh4GIc4Yc+QsCFIAo5VjXB43hw ru+UC6cEDn0TNxXF8X5ScQnwgHfF3R+8vdskOL/DSFiN3R1DjT2QIOviORxubvyrFPr4 DWc6Tl+RvHny5LNkVR60TYiFrkqnJlOX+RqEpL0DTK77O/QpuGMdA61gkxCiWv3d9Cbm 0Z5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739801995; x=1740406795; 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=fFwoen2n6A3xEmQGO9XWd+wlPy573IpuepvIjETX2XU=; b=gyHXpMAQi10UP1IlJxAiNkZdVFFBWVOoM4/NrVgbt8cTEvxG50v5tMe9xYKskHz8Vi jzjHz03wvEeUeB6ONocLVDGQcwDA7QA0YjitYFm61jDCj5j57egXhJrkdNvB4r5g/Wr+ 9egpyJQbG1NW0ctORYC4vCJLwKNF/uOYwBSgWbZoQhBGpkzku0MDjh1zDPnGGVNmM8mr nUIxe0KW0IZzkEAD8R9QFo4E2zUVkQeadH+6NxJXqiOcnblMh1LAKaU7/5P2wbZlQjPS KdKJkURZBuQ7jSQcdQFVy7NHh+JaqsB6KHsvx7fM+wRRycnNyTVDYXtxRDBmvXHHKIgh b3wQ== X-Forwarded-Encrypted: i=1; AJvYcCUgTrBjOjkt77f3/OUo8LzI3wAt2JWtzkz1EyTuWtRlbx9O7Y0RuBtiFQEizKlzRdiliuISwUa1x0Qn6WF/@lists.postgresql.org X-Gm-Message-State: AOJu0YzUwV7KtTQfvqBsdxXRGfjhDNFJlD/FotJ31e0W35H4UZfGkFrX zIqF7U3WeabeST/+ucDMXF2i6QPqoj4OenV4/zfsdC6xKoJCtkLZLGs00HatFYjT5OJnh1UmG0k WhwTcuUNS4BQIRKvKEBBXjtuORsY= X-Gm-Gg: ASbGnctWmiV/dcri9xfub1CFr68RI1YmuF5j3nq0i63/5tc4emN+YvKwO8Iz+QWh2qp IrGuo0kPxSgPRMQOcKgzQYIPCYtq5Rdf3WLzyCyWUesdGqyhKK6rhU9H/N6pG+cE2Qkn4RzZS X-Google-Smtp-Source: AGHT+IHqe0eqYDzUeDoKrdLtIXHbI5VFD50DCdfqsGyyRp5bq+cu62f+NqB7XoVVQCzcP1czxlxNT2yJG7WwZ+wgtJo= X-Received: by 2002:a17:906:3ca9:b0:ab2:f6e5:3f1 with SMTP id a640c23a62f3a-abb70848a57mr780361166b.8.1739801995022; Mon, 17 Feb 2025 06:19:55 -0800 (PST) MIME-Version: 1.0 References: <55695d15-c738-4401-8883-58bc855c9b03@tantorlabs.com> <58bb3a5b-c92a-408c-b02a-f47aedc1c0e2@tantorlabs.com> <70bc1af0-6910-4f71-84ba-fa02095fe9ba@tantorlabs.com> <3212947.1739306803@sss.pgh.pa.us> <3365160.1739385615@sss.pgh.pa.us> <0e4c813a-18eb-41e2-8edb-89b78d43c82d@gmail.com> <01ec86c1-e04b-4cbe-b641-22cae8b87604@tantorlabs.com> In-Reply-To: <01ec86c1-e04b-4cbe-b641-22cae8b87604@tantorlabs.com> From: Robert Haas Date: Mon, 17 Feb 2025 09:19:43 -0500 X-Gm-Features: AWEUYZncyjXcOFaBdiaFJ-CYcbI9KAKfbu6xKjQorTBhQfF5rAZBkb9_g0NkBF0 Message-ID: Subject: Re: explain analyze rows=%.0f To: Ilia Evdokimov Cc: Andrei Lepikhov , pgsql-hackers@lists.postgresql.org, Tom Lane , Matheus Alcantara , Guillaume Lelarge , Daniel Gustafsson , Ibrar Ahmed , "Gregory Stark (as CFM)" , Amit Kapila , Justin Pryzby , Peter Geoghegan , vignesh C , "David G. Johnston" , Alena Rybakina 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 Mon, Feb 17, 2025 at 3:08=E2=80=AFAM Ilia Evdokimov wrote: > You're right=E2=80=94floor shouldn't be used since it behaves differently= across > platforms, as Tom also pointed out earlier. I like the idea of using %, > but since the compiler doesn't allow this operation with double, we need > to cast it to int64. I checked how nloops and ntuples are modified - > they are only incremented by 1. So that the casting might be safe. If I > missed anything or if there's a reason why this casting wouldn't be > safe, please let me know. What I've been advocating for is just: if (nloops > 1) Instead of: if (nloops > 1 && rows_is_fractonal) I don't think it's really safe to just cast a double back to int64. In practice, the number of tuples should never be large enough to overflow int64, but if it did, this result would be nonsense. Also, if the double ever lost precision, the result would be nonsense. If we want to have an exact count of tuples, we ought to change ntuples and ntuples2 to be uint64. But I don't think we should do that in this patch, because that adds a whole bunch of new problems to worry about and might cause us to get nothing committed. Instead, I think we should just always show two decimal digits if there's more than one loop. That's simpler than what the patch currently does and avoids this problem. Perhaps it's objectionable for some other reason, but if so, can somebody please spell out what that reason is so we can talk about it? --=20 Robert Haas EDB: http://www.enterprisedb.com