Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gd8qa-0001R9-WB for pgsql-performance@arkaria.postgresql.org; Sat, 29 Dec 2018 07:15:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gd8qY-0007xf-TH for pgsql-performance@arkaria.postgresql.org; Sat, 29 Dec 2018 07:15:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gd8qY-0007wL-D6 for pgsql-performance@lists.postgresql.org; Sat, 29 Dec 2018 07:15:46 +0000 Received: from mail-it1-x141.google.com ([2607:f8b0:4864:20::141]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gd8qQ-0001H5-UE for pgsql-performance@postgresql.org; Sat, 29 Dec 2018 07:15:44 +0000 Received: by mail-it1-x141.google.com with SMTP id g85so30933785ita.3 for ; Fri, 28 Dec 2018 23:15:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=ekGVyumX9uTXr7jCyRaF1uaaf1o2h4kDkZKf93SwAcM=; b=BxxMNTfLFxtUz5gONu0AqoPaK/dsNy0+5+R1drtk6jb6KoRVXbEecf4F/8koQ195Kp pHb6os894ZE4ISRVsKPKgJLED1MJb/r6V+8LIWAJYVGyLMcDM18A7yA/N5zqY1hPupZE F3u+UPDbSZQO0dcgu9HbAMbt/4wAxaUIvE3JaUbDm582evXdALY9qRy7kNQOPo4It6CE URn/kTrxe4T2NpH1WtIdNBW7d+4ndJ1rokP395+Ah9XuejgYxYJcSDcmR9Ynb9zXv7F8 8NsXcYuZ8X9ePgfC0CNF9XJZuIK/oN2tWC5Wi4QH/iWxoif4NEvii49fAup8s6vNvltR 4RvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=ekGVyumX9uTXr7jCyRaF1uaaf1o2h4kDkZKf93SwAcM=; b=d8GBChp8caSQ6eWI9r+Jj5obt76rEA1TvM1Z1Zdk0s1D8SStdYsQ7yqs+HSI3+m+7V 7fxFrVlgXd16zHtH6nZTazONY4IEEJyiK71U39JIr6wJK/19LXj9gVWoQkCoZr5V4uUY CG7+6KQheQoD4OtbkM7tIJ+5vut4oF7R9lMskY1M6WBlj8OTJQbVRohnNuR5nr3WHhmx 04Ah3HYHWk5lsBBihlyMIywSiMk8jmDlXcuTYaEiIjXrvTC2xyDLrgNlWZMmVj1jzCT8 TtxWonFBagxqhBQKskhpAn7vFTHukhPXdxwhXXscykNaI5kN58QtZuLwXpfx2MYY7kZN 9ZNg== X-Gm-Message-State: AJcUukeFhMQJTy60d1E7tBAPufsptJW6bNU0BuSV8+QNsbW/VXzcRmXs 8lHFnjVDbH80Hw3ojhXKJ4c/IzOz09o= X-Google-Smtp-Source: AFSGD/WiuFvfowQenyK5oM56PuLu8jmNzRRnqhbjrWlISGBe9x8Vc0LzMDw8ABwPRmD+SkQjZe4KVw== X-Received: by 2002:a24:ba0b:: with SMTP id p11mr19261862itf.113.1546067737455; Fri, 28 Dec 2018 23:15:37 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id u25sm18701852iob.23.2018.12.28.23.15.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Dec 2018 23:15:36 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id CD4FC8054BB; Sat, 29 Dec 2018 01:15:35 -0600 (CST) Date: Sat, 29 Dec 2018 01:15:35 -0600 From: Justin Pryzby To: =?utf-8?B?bmVzbGnFn2Fo?= demirci , David Rowley Cc: pgsql-performance@postgresql.org Subject: Re: Query Performance Issue Message-ID: <20181229071535.GX30382@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Dec 27, 2018 at 10:25:47PM +0300, neslişah demirci wrote: > Have this explain analyze output : > > *https://explain.depesz.com/s/Pra8a * On Sat, Dec 29, 2018 at 07:58:28PM +1300, David Rowley wrote: > On Sat, 29 Dec 2018 at 04:32, Justin Pryzby wrote: > > I think the solution is to upgrade (at least) to PG10 and CREATE STATISTICS > > (dependencies). > > Unfortunately, I don't think that'll help this situation. Extended > statistics are currently only handled for base quals, not join quals. > See dependency_is_compatible_clause(). Right, understand. Corrrect me if I'm wrong though, but I think the first major misestimate is in the scan, not the join: |Index Scan using product_content_recommendation_main2_recommended_content_id_idx on product_content_recommendation_main2 prm (cost=0.57..2,031.03 rows=345 width=8) (actual time=0.098..68.314 rows=3,347 loops=1) |Index Cond: (recommended_content_id = 3371132) |Filter: (version = 1) |Rows Removed by Filter: 2708 Justin