Showing alternative query planner plans with explain ? - Mailing list pgsql-general

From Danny Shemesh
Subject Showing alternative query planner plans with explain ?
Date
Msg-id CAFZC=QpMZutOUnJATYzLiuvM9CAk7UPpWmnZX6uGXxgHYSE6nw@mail.gmail.com
Whole thread Raw
Responses Re: Showing alternative query planner plans with explain ?
List pgsql-general
Hey all !

I'm currently optimizing queries and indices on a relatively large dataset;
one of the frequent questions I seem to ask myself is why the planner chooses plan A over B.

Reading the docs, blogs, stack exchange posts, wiki, ... helps in trying to tinker with the query or indices in a way that either A will be discouraged, or B will be favoured, so I'd be more informed on why one was chosen over the other and which is empirically better for a given dataset.

A tool I seem to be missing, and I wondered if such exists, is to have the planner output alternative plans for a given query, i.e. to say, give me the x top plans sorted by cost - I believe this would help shed some light on the internal state machine and subsequent tinkering less trial-and-error-ish.

Is there any way to achieve the above ?

Thanks a ton,
Danny


pgsql-general by date:

Previous
From: Shaheed Haque
Date:
Subject: Re: JSONB index not in use, but is TOAST the real cause of slow query?
Next
From: Tom Lane
Date:
Subject: Re: Showing alternative query planner plans with explain ?