From: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> |
---|---|
To: | Lars Aksel Opsahl <Lars(dot)Opsahl(at)nibio(dot)no> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: Fast insert, but slow join and updates for table with 4 billion rows |
Date: | 2016-10-24 20:23:12 |
Message-ID: | CAOR=d=2oWn4RQ_CxyD19-P+HeMT8=dnW8GaonkTZKWt7mbCvtQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Mon, Oct 24, 2016 at 2:07 PM, Lars Aksel Opsahl <Lars(dot)Opsahl(at)nibio(dot)no> wrote:
> Hi
>
> Yes this makes both the update and both selects much faster. We are now down to 3000 ms. for select, but then I get a problem with another SQL where I only use epoch in the query.
>
> SELECT count(o.*) FROM met_vaer_wisline.nora_bc25_observation o WHERE o.epoch = 1288440000;
> count
> -------
> 97831
> (1 row)
> Time: 92763.389 ms
>
> To get the SQL above work fast it seems like we also need a single index on the epoch column, this means two indexes on the same column and that eats memory when we have more than 4 billion rows.
>
> Is it any way to avoid to two indexes on the epoch column ?
You could try reversing the order. Basically whatever comes first in a
two column index is easier / possible for postgres to use like a
single column index. If not. then you're probably stuck with two
indexes.
From | Date | Subject | |
---|---|---|---|
Next Message | Lars Aksel Opsahl | 2016-10-24 20:44:32 | Re: Fast insert, but slow join and updates for table with 4 billion rows |
Previous Message | Lars Aksel Opsahl | 2016-10-24 20:07:35 | Re: Fast insert, but slow join and updates for table with 4 billion rows |