From: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
---|---|
To: | Corey Taylor <corey(dot)taylor(dot)fl(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: How to see index was rejected for seq scan? |
Date: | 2017-12-16 14:25:07 |
Message-ID: | 49e61761-9b33-436e-0568-807f5cf06146@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 12/16/17 04:03, Corey Taylor wrote:
> Essentially, if an index was deemed not to save cost during the input
> scan, the planner will schedule a seq scan. What I'm wondering if there
> is anything that indicates a valid index for the scan was found and
> rejected (reason doesn't necessarily matter). I couldn't find anything
> in the using explain document, but I have probably missed it. I would
> assume the index would be used to determine if the filter requires a
> large scan count.
This isn't really possible in the general case, because the planner
doesn't actually materialize all possible plans for complex queries,
which would be very expensive.
But for simple queries, you might get some insight if you set
enable_seqscan to off. Then the planner will give you an index-using
plan if it is at all possible. Then you can compare the costs. If the
planner still gives you a sequential scan, then the index was not
applicable for other reasons.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | chiru r | 2017-12-16 17:22:12 | Re: PgBackRest question? |
Previous Message | Alessandro Aste | 2017-12-16 12:40:54 | RE: pgstattuple free_percent to high |