Question slow query

From: Patrick B <patrickbakerbr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Question slow query
Date: 2017-01-12 02:15:59
Message-ID: CAJNY3iu7hnxSLTcx-oOwGmvd9wTTKBBRPbOmeEeXyjkKwdthqg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi guys,

I've got a slow query, running at 25 seconds.

-> Bitmap Heap Scan on ja_notes r_1103088
(cost=234300.55..1254978.62 rows=553275 width=101) (actual
time=1423.411..10572.549 rows=475646 loops=1)
Recheck Cond: (n_type = ANY
('{note,note_1,note_2}'::n_type[]))
Filter: (timezone('Etc/UTC'::text,
d_modified) >= '2016-08-07 23:12:34'::timestamp without time zone)
Rows Removed by Filter: 13725231

As you can see, 13.725.231 rows were removed by Filter..

Should I create an index for this column?

> d_modified | timestamp with time zone | default
> statement_timestamp()

I tried but it didn't help... the query doesn't even hit the index.

CREATE INDEX q ON test USING BTREE (d_modified);

Am I missing something?

Thanks!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ian Lewis 2017-01-12 02:39:19 Re: Means to emulate global temporary table
Previous Message Karl Czajkowski 2017-01-12 02:12:44 Re: Are new connection/security features in order, given connection pooling?