Pavel Stehule <pavel.steh...@gmail.com> writes: > I am trying to fix slow query on PostgreSQL 9.5.4. > The data are almost in RAM
If it's all in RAM, you'd likely be well-served to lower random_page_cost. It looks to me like the planner is estimating pretty accurately how many heap fetches will be eliminated by using the extra index; where it's off seems to be in the cost of those heap fetches relative to the index work. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers