pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Abadie Lana <Lana.Abadie@iter.org>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Very slow query (3-4mn) on a table with 25millions rows
Date: Mon, 25 Jul 2016 14:06:57 -0400
Message-ID: <4248.1469470017@sss.pgh.pa.us> (raw)
In-Reply-To: <E544BB9A64ABD24DA201745FD316D94551122DDA@XCH2.iter.org>
References: <E544BB9A64ABD24DA201745FD316D94551122DDA@XCH2.iter.org>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

Abadie Lana <Lana.Abadie@iter.org> writes:
> I'm having a problem with a slow query - I tried several things to optimize the queries but didn't really help. The output of explain analyse shows sequential scan on a table of 25 million rows. Even though it is indexed and (I put a multi-column index on the fields used in the query), the explain utility shows no usage of the scan...

That index looks pretty useless judging from the rowcounts, so I'm not
surprised that the planner didn't use it.  You might have better luck with
an index on the split_part expression

split_part(split_part((s.attvalue)::text, ' '::text, 1), '.'::text, 1)

since it's the join of that to e.name that seems to be actually selective.
(The planner doesn't appear to realize that it is, but ANALYZE'ing after
creating the index should fix that.)

			regards, tom lane


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (9+ messages)  latest in thread

Message-ID: <4248.1469470017@sss.pgh.pa.us>
Permalink:  ../4248.1469470017@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4248.1469470017@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, Lana.Abadie@iter.org
  Subject: Re: Very slow query (3-4mn) on a table with 25millions rows
  In-Reply-To: <4248.1469470017@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox