pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Rob Sargent <robjsargent@gmail.com>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: query not scaling
Date: Mon, 30 Oct 2017 23:57:34 +0100
Message-ID: <1509404254.3584.2.camel@cybertec.at> (raw)
In-Reply-To: <046d23a1-3748-8636-7e1a-e383cebff692@gmail.com>
References: <6f7d4fd4-aed2-2fae-f551-d0f67196da33@gmail.com>
	<1509001363.2666.1.camel@cybertec.at>
	<30441.1509030087@sss.pgh.pa.us>
	<046d23a1-3748-8636-7e1a-e383cebff692@gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>

On Thu, 2017-10-26 at 19:07 -0600, Rob Sargent wrote:
>    ->  Nested Loop  (cost=3799.40..44686205.23 rows=1361304413 width=40)
>                     (actual time=55.443..89684.451 rows=75577302 loops=1)

>          ->  Hash Join  (cost=3798.98..43611.56 rows=823591 width=32)
>                         (actual time=55.393..1397.509 rows=823591 loops=1)

>          ->  Index Scan using marker_chrom_basepos_idx on base.marker m
>                         (cost=0.42..37.67 rows=1653 width=20)
>                         (actual time=0.010..0.075 rows=92 loops=823591)
>              Index Cond: ((m.chrom = 22) AND (m.basepos >= s.startbase) AND
(m.basepos <= s.endbase))

I think your biggest problem is the join condition
   on m.basepos between s.startbase and s.endbase

That forces a nested loop join, which cannot be performed efficiently.

Yours,
Laurenz Albe


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



view thread (9+ messages)  latest in thread

Message-ID: <1509404254.3584.2.camel@cybertec.at>
Permalink:  ../1509404254.3584.2.camel@cybertec.at/
Also on:    postgresql.org/message-id/1509404254.3584.2.camel@cybertec.at

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, robjsargent@gmail.com
  Subject: Re: query not scaling
  In-Reply-To: <1509404254.3584.2.camel@cybertec.at>
  References: <6f7d4fd4-aed2-2fae-f551-d0f67196da33@gmail.com> <1509001363.2666.1.camel@cybertec.at> <30441.1509030087@sss.pgh.pa.us> <046d23a1-3748-8636-7e1a-e383cebff692@gmail.com> <1509404254.3584.2.camel@cybertec.at>

* 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