Re: [GENERAL] Matching indexe for timestamp - Mailing list pgsql-general

From David G. Johnston
Subject Re: [GENERAL] Matching indexe for timestamp
Date
Msg-id CAKFQuwZ5Nx5OANS1nhx-mEsvQa4nbLYJ8c3vQg_AgO7C7qxCbQ@mail.gmail.com
Whole thread Raw
In response to [GENERAL] Matching indexe for timestamp  (Job <Job@colliniconsulting.it>)
List pgsql-general
On Mon, Jan 9, 2017 at 2:58 PM, Job <Job@colliniconsulting.it> wrote:

But in the query planner, at that point, Postgresql 9.6.1 seems not to use any index (single on dalle / alle field and combindex index on dalle+alle) but it use seqscan:
 
Seq Scan on gruorari_tmp  (cost=0.00..5.90 rows=290 width=68) (actual time=0.014..0.062 rows=290 loops=1)
                                 ->  Hash  (cost=164.06..164.06 rows=1 width=29) (actual time=0.770..0.770 rows=1 loops=1)


​Given a query with expected "rows=290" I am not surprised that it would simply scan the entire relation.  Especially since you have four columns in your where clause and so any one index would be insufficient.

You sound as if you believe that any query that doesn't use an index is flawed.  That is not the case.

David J.

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: R: [GENERAL] Matching indexe for timestamp
Next
From: Vitaly Burovoy
Date:
Subject: Re: [GENERAL] Matching indexe for timestamp