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 1uwSNU-002WxB-7Z for pgsql-general@arkaria.postgresql.org; Wed, 10 Sep 2025 21:29:20 +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 1uwSMS-003X94-Tw for pgsql-general@arkaria.postgresql.org; Wed, 10 Sep 2025 21:28:17 +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 1uwSMS-003X8w-Cl for pgsql-general@lists.postgresql.org; Wed, 10 Sep 2025 21:28:17 +0000 Received: from skyblue.cherry.relay.mailchannels.net ([23.83.223.167]) by makus.postgresql.org with smtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uwSMQ-001jLE-1m for pgsql-general@postgresql.org; Wed, 10 Sep 2025 21:28:15 +0000 X-Sender-Id: dreamhost|x-authsender|nico@cryptonector.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id AA75518467B; Wed, 10 Sep 2025 21:28:12 +0000 (UTC) Received: from pdx1-sub0-mail-a206.dreamhost.com (100-107-7-150.trex-nlb.outbound.svc.cluster.local [100.107.7.150]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 46843183F68; Wed, 10 Sep 2025 21:28:12 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1757539692; a=rsa-sha256; cv=none; b=cMj9UK3X2Ac90uW6xt6jO2/qrky74BZ+usa1WF5SJ+iRSABpv14EhExPAKk9wZRX7MIp+8 OHtKiCssknL7qIye+mgrqunUKLyfhP9eFomIyFXcLefBFpcEGVxGdIv5NtEb2SW86RbPgd WBaypA1IEnyHnnfUqAfqy56xOl+eN2KWteclrcMeQa78qM+9b/4iRHQHDExYmwsBf4eNTm 3wdATBpSpMJdPvh2v8egSmQrmQHlCe6t3+hezxI9BeBixhrGD5hErIk5MAU07itaSiRJrE WkCrrQoUhiLCGW6XqqMf66u3yJ10okKaiz0mX6iVlBXzbDe6otR5b7G+i1nBpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1757539692; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=I711edKVq2i5vGkQxT8VK8idM5JYWwBCa6itsOO44H8=; b=Vz6TSvwdZuePyE3Ozqb5U4Piqinz5zEcKOH6H399oOc63RXA/eqiA3TUMwUQifedQQYW/o TRcSMmtZ83TzBY2NYw630/HTXufJbGTCNPFXoMHNMuzks94g8V+THOLQzs07r8Z22GrdUH ldLjvBTYtYDtbUt/VkdY5yKFktVWzJ28JCAMcZtKgdyFpbJdigLscrtHmpkiMJq1sXOJnU 8gfbpCnSc/tc2gJce8Gin8PDNWy7n3Yx09rHp0b+UJiGCNDh/XmGot83/F34S74f3Oeikw 7yMECFyGpjq7O+zMQyMnfQTfBP9opAumaSg6ysVlYO7oVVwKxLjKQW5tVtwzgA== ARC-Authentication-Results: i=1; rspamd-54bcd779b6-7mvtd; auth=pass smtp.auth=dreamhost smtp.mailfrom=nico@cryptonector.com X-Sender-Id: dreamhost|x-authsender|nico@cryptonector.com X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|nico@cryptonector.com X-MailChannels-Auth-Id: dreamhost X-Broad-Hysterical: 060bee5c28ee62c6_1757539692542_343902075 X-MC-Loop-Signature: 1757539692542:3998297775 X-MC-Ingress-Time: 1757539692542 Received: from pdx1-sub0-mail-a206.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.107.7.150 (trex/7.1.3); Wed, 10 Sep 2025 21:28:12 +0000 Received: from ubby (syn-075-081-095-064.res.spectrum.com [75.81.95.64]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nico@cryptonector.com) by pdx1-sub0-mail-a206.dreamhost.com (Postfix) with ESMTPSA id 4cMYhC48rMzC8; Wed, 10 Sep 2025 14:28:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cryptonector.com; s=dreamhost; t=1757539692; bh=1jUX7HtCf4W5ccy5w7BfbpnigQSWeU9c1hnpYw8UV7E=; h=Date:From:To:Cc:Subject:Content-Type; b=IVLlZt43CzGXu8xooYMom29YwzfqE1Fp9N3QGF2p8+Tfn+ZPSmJa3x0Eu6en3Pqq8 KjcoJmsRMR5zAVXvI6vnguYW1WWV29I2e2griVTM4I8C2//lgkuDg9bDihGsKcNSqg aSFGIo1/INbyxl1pW6cooPW6rZnF21K1TPwvpCFEy2GYP+fHxsrjvFcgVPrZcxyPgg QWm16OX1yr8pQRkkhgGBpE6N49X3NXQKTz9v27TVhZiSZ24x3zOIefeNwfzvV3So1H 9IAigU0ioZzQQWUInGC/epmBEWIUlcwNVZ/2Ig4luWpj6Af6TP0nnVKhUE9fd7Cgl1 4gndlqjYZhMAg== Date: Wed, 10 Sep 2025 16:28:09 -0500 From: Nico Williams To: Justin Cc: Merlin Moncure , Ellen Allhatatlan , pgsql-general Subject: Re: MVCC and all that... Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Sep 09, 2025 at 08:41:02PM -0400, Justin wrote: > The author brings up threaded vs multi-process. That's an old old old old > old conversation that has been shown there is no clear better way. This is relevant to the next part: > Number of open connections. so firebird can do 1000 open sessions with a > smaller memory footprint, still can not have 1000 simultaneous running > sessions unless we have 1000 CPU's. Where is the win here?? We should be > managing resources better on the application side, not opening thousands of > connections that sit idle doing nothing. When a service is written in such a way as to minimize the memory footprint of each request/client then it can process more of them assuming it's only memory-bound. Why? Because less memory per thing == less bandwidth use, and also less thrashing of caches and higher cache hit ratios. Minimizing request/client state means not spreading any of it on the stack, thus not requiring a stack per-client. This means not thread-per-client (green or otherwise) or process-per-client. It means essentially some flavor of continuation passing style (CPS). For a query plan executor that's really: the query plan, all the in-flight I/O requests, all cached data still needed to continue processing the plan. If you have a Duff's device style / CPS style implementation, then nothing on the stack needs to be preserved while waiting for I/Os, and the state of the query plan is effectively minimized. But for a database with storage I/O costs the memory footprint doesn't matter quite so much because most likely it will be I/O bound rather than CPU- or memory-bound. > "PostgreSQL has a relatively simple, but fast query planning algorithm" > Compared to what.... What feature is PG missing these days... the only > thing I know it can't do is change the plan in the middle of the > execution stage. Which is not a query planner thing but the execution > layer saying to itself I am taking too long maybe go back to the planning > stage... Query Hints that have been discussed endlessly. Adding hints > adds its own problems and has become a big mess for databases that support > it. I would really like out-of-band hints. These would be hints not specified in the SQL itself but to be sent separately and which address table sources or joins by name, like this: psql> SELECT .. FROM x x1 JOIN y y1 ON .. JOIN y y2 ON .. WHERE ..; ...> \hint y1 indexed by .. ...> \hint y2 indexed by .. ...> ; > Multiple transactions per connection. I am asking WHY is that a feature. > when one can have multiple sessions, what is the difference? running > multiple transactions in single or multiple sessions means moving part of > transaction logic into the application space. What do we gain here..... I agree it's not really important. Moreover interleaving multiple queries over one TCP connection will lead to having to manage how much bandwidth each query consumes so as not to drown out the others. > No application packaging. This Oracle thing that firebird has duplicated > at some level. we can simulate this with namespace/schemas. And extensions. > XID being 32 bit This is a huge problem. > Temporary tables are a pain and cause issues for big databases Yes. PG badly needs GLOBAL TEMP. Another thing that would be nice is if PG could have tables that are not heaps. Nico --