pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Lars Aksel Opsahl <Lars.Opsahl@nibio.no>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Fast insert, but slow join and updates for table with 4 billion rows
Date: Mon, 24 Oct 2016 08:52:08 -0400
Message-ID: <21210.1477313528@sss.pgh.pa.us> (raw)
In-Reply-To: <ecea7a5ae84345d2bbe12bb9e3f1edf6@nibio.no>
References: <ff268c342e0646f3a2bffc05a29154aa@nibio.no>
	<58dff6f9c2e64a8bb82a990ea1910d32@nibio.no>
	<ecea7a5ae84345d2bbe12bb9e3f1edf6@nibio.no>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

Lars Aksel Opsahl <Lars.Opsahl@nibio.no> writes:
> In this example I have two tables one with 4 billion rows and another with 50000 rows and then I try to do a standard simple join between this two tables and this takes 397391  ms. with this SQL (the query plan is added is further down)

This particular query would work a lot better if you had an index on
nora_bc25_observation (point_uid_ref, epoch), ie both join columns
in one index.  I get the impression that that ought to be the primary
key of the table, which would be an even stronger reason to have a
unique index on it.

			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 (6+ messages)  latest in thread

Message-ID: <21210.1477313528@sss.pgh.pa.us>
Permalink:  ../21210.1477313528@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/21210.1477313528@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, Lars.Opsahl@nibio.no
  Subject: Re: Fast insert, but slow join and updates for table with 4 billion rows
  In-Reply-To: <21210.1477313528@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