Search Postgresql Archives

Re: index selection by query planner

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rohit Gaddi <rohitgaddi@xxxxxxxxxxx> writes:
> I have a table with two indices on the same column, one of which is a partial index. I would like the query planner to use the partial index whenever the query condition lies in the range of the partial index as it would yield better performance. Is there any way to enforce the ordering for the indices? How does the query planner decide which index to use when a particular query is fired?  'Explain Analyze' showed the total index being used in a situation that could be fulfiled by the partial index.

When you're asking this sort of question you should actually *show* the
EXPLAIN ANALYZE results.  I would also suggest showing the comparison
to the other plan, which you can get in a nondestructive way like this:

	EXPLAIN ANALYZE .... ;
	-- plan using total index here

	BEGIN;
	DROP INDEX total_index;
	EXPLAIN ANALYZE .... ;
	-- plan using partial index here, we hope
	ROLLBACK;

Also, this is really on-topic for pgsql-performance, not either of the
two lists you have chosen.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux