Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eAamj-0002aN-Os for pgsql-performance@arkaria.postgresql.org; Fri, 03 Nov 2017 12:09:17 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1eAamj-0007lw-Bb for pgsql-performance@arkaria.postgresql.org; Fri, 03 Nov 2017 12:09:17 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eAakv-0000vf-C6 for pgsql-performance@postgresql.org; Fri, 03 Nov 2017 12:07:25 +0000 Received: from mail-ot0-x22d.google.com ([2607:f8b0:4003:c0f::22d]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1eAakk-0003Kc-Ht for pgsql-performance@postgresql.org; Fri, 03 Nov 2017 12:07:24 +0000 Received: by mail-ot0-x22d.google.com with SMTP id f18so2215494otd.10 for ; Fri, 03 Nov 2017 05:07:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=p+6JuKywJpf49Ge0H4uPsAFazwqSaMluSYIOOy3aZ9k=; b=WrKlLdLHophsqeTM+KyRrfc4y89qM4vJZMggu3cOZIlfK/vV3a665+wUWL3ispjg8e /iwc0tJ613Boflk64nZF4Ags92hJsDEeouBbwkhCn20eOyMgR5Ti52toM3H7Q2Oq36wC ftiF/WSPK9pKnOTL8pOjeoZDO8slGYaWQ92GS1p/09HV8pL1nDLehN6zCwdAfS/gOiSv i5N7Xami0rAbOCBQUsH+tdAydHDj0MVqqsMTrxBJKzqcPPfONRN9B8jj3ZSIgT6ss2mb kKptASY8p6IMBDWoihxFOMUhvWDnwxxdNhh+HmH0RM2weIa1Bi2FL5DWt3Rin99SDJ43 WwdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=p+6JuKywJpf49Ge0H4uPsAFazwqSaMluSYIOOy3aZ9k=; b=OMA4WM3IU59BH7Ibws3fVAw7QYvUT3SljUOLT5VR3296y9ICroR0eRV4aqtW4SkgZ8 1MSMPtUaowFO30UdnVgkI3EtqjKboXIoyiS0UK+ORYu+JQPEPZDd7HIenCOi1AM9y2nf Hu/OZf3cfLTS38Yksp4EAQ+C0/OjcQW/jY2BrtUqW1RL5qE4F3kOG5HLzyCIiURtkfd7 /xEv5L4C7XNpUm2TewZ12HDoN4JU6cld7zV00bKopggUIk4/ziNrGblGxsIG1Y+5jrD8 hgX9xyBGUcTlPR1SQ6X2LKe4bxU77y5uU8fm7E6cb7TNq4yGKGa1snDfbR2Za8RNtIg7 apAQ== X-Gm-Message-State: AJaThX6O7nSZjvzRELWNbQpkHi4bUH9f/Tj0lcF8OsKX17RPkMjCH1TW TBljyfajAVXAzwfcqoxxdE0OddgvCJ2k3TWNjeU= X-Google-Smtp-Source: ABhQp+TxZjoK2eWypMJHunUZe3qfJfWNzxlWQyAiQyLV5k9LsVdxf3SWhZjpHrh1y9eregC+N3ce6ynydpswdICO8sM= X-Received: by 10.157.43.132 with SMTP id u4mr3979686ota.17.1509710833649; Fri, 03 Nov 2017 05:07:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.6.162 with HTTP; Fri, 3 Nov 2017 05:07:13 -0700 (PDT) In-Reply-To: <1509701327868-0.post@n3.nabble.com> References: <1509611428.3268.5.camel@cybertec.at> <1509701327868-0.post@n3.nabble.com> From: Adam Brusselback Date: Fri, 3 Nov 2017 08:07:13 -0400 Message-ID: Subject: Re: Re: OLAP/reporting queries fall into nested loops over seq scans or other horrible planner choices To: Thomas Kellerer Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset="UTF-8" List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On Fri, Nov 3, 2017 at 5:28 AM, Thomas Kellerer wrote: > I do like Oracle's approach with SQL profiles, where you can force the > optimizer to try harder to find a good execution plan. I _think_ it even > runs the statement with multiple plans and compares the expected outcome > with the actual values. Once a better plan is found that plan can be > attached to that query and the planner will use that plan with subsequent > executions. I also think that this is a really cool approach. For those specific problem queries, pretty much tell the optimizer "do your best to make this as efficient as possible". To make that more useful though, you'd probably need a shared query cache that would be persisted through restarts. I'd assume if you have a problem query, this very heavy "planning / optimization" operation would not be something you wanted every connection to have to do every time they connect. I wish I was more knowledgeable about the internals so I could more clearly see how a system like that could come together, and what other groundwork would be needed building up to it. -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance