Re: Cardinality estimate of the inner relation

2024-11-22 Thread Andrei Lepikhov
On 22/11/2024 22:53, Frédéric Yhuel wrote: My colleague Christophe Courtois and I have been trying to fix a bad plan for one of Dalibo's clients. It is a (probably well-known) problem with skewed data and a parameterized Nested Loop with an underestimation of the cardinality of the inner relati

Re: could not send data to client: Connection reset by peer

2024-11-22 Thread Tomas Vondra
On 11/21/24 13:13, James Pang wrote: > experts, >    Postgresql v14.8,  client app use Postgresql JDBC, it start a single > query that return 470k rows totally in one time, but sometimes, database > server side got error "could not send data to client: Connection reset > by peer".  >    any idea wh

Cardinality estimate of the inner relation

2024-11-22 Thread Frédéric Yhuel
My colleague Christophe Courtois and I have been trying to fix a bad plan for one of Dalibo's clients. It is a (probably well-known) problem with skewed data and a parameterized Nested Loop with an underestimation of the cardinality of the inner relation. Here is a test case (the script to cre

Re: Performance of Query 60 on TPC-DS Benchmark

2024-11-22 Thread Andrei Lepikhov
On 22/11/2024 18:12, Ba Jinsheng wrote: I think the key difference is that the patch disables the usage of Hash Join, which incurs a worse performance. I see here a problem with a number of groups: when predicting it incorrectly, Postgres doesn't use the Memoize node. Disabling HashJoin puts Ne