pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Yavuz Selim Sertoglu <yavuzselim.sertoglu@medyasoft.com.tr>
Cc: pgsql-performance@lists.postgresql.org <pgsql-performance@lists.postgresql.org>
Subject: Re: Gained %20 performance after disabling bitmapscan
Date: Fri, 19 Oct 2018 09:52:04 -0400
Message-ID: <31172.1539957124@sss.pgh.pa.us> (raw)
In-Reply-To: <AM6PR07MB520725A8D1B1287AE313928FD7F90@AM6PR07MB5207.eurprd07.prod.outlook.com>
References: <AM6PR07MB520725A8D1B1287AE313928FD7F90@AM6PR07MB5207.eurprd07.prod.outlook.com>

Yavuz Selim Sertoglu <yavuzselim.sertoglu@medyasoft.com.tr> writes:
> I have a problem with my query. Query always using parallel bitmap heap scan.

Have you messed with the parallel cost parameters?  It seems a bit
surprising that this query wants to use parallelism at all.

>         Index Cond: (((mukellef_id)::text = '0123456789'::text) AND (kayit_tarihi >= '2018-01-01 00:00:00'::timestamp without time zone) AND (sube_no = '-13'::integer) AND ((defter)::text = 'sm'::text))

If that's your normal query pattern, then this isn't a very good
index design:

>     Column    |            Type             |  Definition
> --------------+-----------------------------+--------------
>  mukellef_id  | character varying(12)       | mukellef_id
>  kayit_tarihi | timestamp without time zone | kayit_tarihi
>  sube_no      | integer                     | sube_no
>  defter       | character varying(4)        | defter
>  id           | bigint                      | id

The column order should be mukellef_id, sube_no, defter, kayit_tarihi, id
so that the index entries you want are adjacent in the index.

Of course, if you have other queries using this index, you might need
to leave it as-is --- but this is the query you're complaining about...

			regards, tom lane




view thread (7+ messages)  latest in thread

Message-ID: <31172.1539957124@sss.pgh.pa.us>
Permalink:  ../31172.1539957124@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/31172.1539957124@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, yavuzselim.sertoglu@medyasoft.com.tr, pgsql-performance@lists.postgresql.org
  Subject: Re: Gained %20 performance after disabling bitmapscan
  In-Reply-To: <31172.1539957124@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