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 1t9aAB-00B63k-A2 for pgsql-performance@arkaria.postgresql.org; Sat, 09 Nov 2024 01:21:18 +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 1t9aA8-00F3Rf-DI for pgsql-performance@arkaria.postgresql.org; Sat, 09 Nov 2024 01:21:16 +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 1t9aA8-00F3RX-37 for pgsql-performance@lists.postgresql.org; Sat, 09 Nov 2024 01:21:16 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t9aA5-000taD-Hh for pgsql-performance@lists.postgresql.org; Sat, 09 Nov 2024 01:21:15 +0000 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-71e49ad46b1so2430061b3a.1 for ; Fri, 08 Nov 2024 17:21:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731115272; x=1731720072; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=h49SV4w1tCrf7e9+pPsXA/4Emy8mmGcmj03phI0eyHI=; b=kgsdOSFsI8e6wPuwKaxXzGhoa/4Qvbn5YEIRZKxkMLA88WpFtUZV8YhgX0+9aW4tJN t0TFy8/QaEacnrIEoya4esYnaEwRP9HS96HCE/gN/YP8BhNhPMX4y/Z/Z23tLmj87JF6 SYnjN5GWNfrcwWivuyWfoCYD/C5UXXLA6b13VLOMoMDbi0uwFAbDwhl9BdGXayvCNoH5 jUP5icjBXXbK19erH3DnwyBks/I+K5e+ye/Q7j2nJDExUS7fjKYtcW8TD9HdFRAN66sG bRk+pCRnJF9iFgM3L4MgBHfrVPNAfMpLM3EYyyJhcmMiCd4PEEozxYEOTXvfcOA7JapA UQhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731115272; x=1731720072; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=h49SV4w1tCrf7e9+pPsXA/4Emy8mmGcmj03phI0eyHI=; b=PFb+7GvAZ8S26PEr5gxGU4eeP0knYo1h21HTZpDVo/kb2ncTjmWMOG0lS2IbTh9236 6Vc24UFV/NSy+oMGURepk8VaOOTduwGF6Qv7jEjDztkEi9BRRYPrjEKFl5yqEpoy4q67 e8eEEc8U9sWrJwT6a5TtAB/D6H+J5K950N62d09kk7zfjgsfePhDF69As4BKfrut5OoK ZY+I8RImH2haw/VoeNBmb26wEKgMDgp/ac78RjCKPzoJJ7Tu7PbkQZCRzus6FeuDiBPk S0kyxwRrZB022QTvBMaLwVs74p7CybUu628iDJxBgvYqQgfiu0iCDo9LNBwhZK/btc5I P69Q== X-Forwarded-Encrypted: i=1; AJvYcCUPPPN6PONwv1+CbpTb5fFZDoQSXpE52eA1c3jikxhto9vulrdP3IHRYlMLrPW5NjDA4zOl5oPquxdR0kJa/4/1uw==@lists.postgresql.org X-Gm-Message-State: AOJu0YzllVVmXuSy+fDdnoG1Zb1ANnzc2UkUePErg3G4IWGLdI7EU3uB NhOD1tdkqVYMJ79SrQQZLCsv5GvfswkTPCAWQHGS5/N8kawaYd82 X-Google-Smtp-Source: AGHT+IFH+BsRBIQnHeCH5SbQEw29VAS+8/8xTv9IfANuJ2x5+G9v3EfFdlv1gBtBj+IsSRQV1yJH1g== X-Received: by 2002:a17:90b:37cf:b0:2e5:8392:afe7 with SMTP id 98e67ed59e1d1-2e9b14dc341mr6734253a91.0.1731115272220; Fri, 08 Nov 2024 17:21:12 -0800 (PST) Received: from [192.168.1.57] (cm-27-145-178-59.revip12.asianet.co.th. [27.145.178.59]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e9a5f5e513sm4321231a91.12.2024.11.08.17.21.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Nov 2024 17:21:11 -0800 (PST) Message-ID: Date: Sat, 9 Nov 2024 08:21:07 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Major performance degradation with joins in 15.8 or 15.7? To: Ed Sabol , pgsql-performance@lists.postgresql.org References: <197E1EF0-BEDF-42C0-8508-56BC6E88AA35@gmail.com> <7A0AB841-65F3-4317-905C-E98D45953E3E@gmail.com> <2afa93b9-17d9-4bdd-bee2-f33dc12383cc@gmail.com> <2F4F210E-3BEA-4365-AB19-AC7917EF9F49@gmail.com> <4190FC09-590B-443F-9064-88B6F7C1EBE2@gmail.com> Content-Language: en-US From: Andrei Lepikhov In-Reply-To: <4190FC09-590B-443F-9064-88B6F7C1EBE2@gmail.com> 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 9/11/2024 03:32, Ed Sabol wrote: > CREATE STATISTICS tablename_stats_rt_nd (ndistinct) ON relation, type FROM tablename; The only one thing I want to note. It is enough to execute: CREATE STATISTICS tablename_stats (mcv,ndistinct,dependencies) ON relation, type FROM tablename; And all the statistics will be build over any possible combination of (relation, type). So, you don't need to call CREATE STATISTICS more than once. -- regards, Andrei Lepikhov