Issue with query scanning through all data even with indexes

From: Kai Sellgren <kaisellgren(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Issue with query scanning through all data even with indexes
Date: 2014-01-09 21:36:53
Message-ID: CANyR-3cyvy95XufRNd9kq4yfuKOskaA0v-8AT7GDBUvRRDKXjQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,

I have a query that has each field used in conditions + sort indexed, but
it scans through all data.

The query in question looks like:

http://pastie.org/8618562

I have each of those condition fields indexed:

NewsArticle.groupId
NewsArticle.sharedToCommunityIds
NewsArticle.sourceFilterIds
CommunityGroupLink.communityId
CommunityGroupLink.groupId
SourceFilter.groupId
SourceFilter.communityId

This is the data output for explain http://d.pr/i/VGT3

And in visual http://d.pr/i/mqiN

Line 7 says rows=99173 which makes it real slow (it can take up to a minute
to run).

Do you have any ideas? All of them are appreciated!

Cheers,

--
Yours sincerely,
Kai Sellgren

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message ambilalmca 2014-01-10 09:46:50 PostgreSQL query for cache performance counters?
Previous Message Marc Cousin 2014-01-06 14:41:35 Re: query plan not optimal