Re: Gained %20 performance after disabling bitmapscan - Mailing list pgsql-performance

From Tom Lane
Subject Re: Gained %20 performance after disabling bitmapscan
Date
Msg-id 31172.1539957124@sss.pgh.pa.us
Whole thread Raw
In response to Gained %20 performance after disabling bitmapscan  (Yavuz Selim Sertoglu <yavuzselim.sertoglu@medyasoft.com.tr>)
Responses Ynt: Gained %20 performance after disabling bitmapscan  (Yavuz Selim Sertoglu <yavuzselim.sertoglu@medyasoft.com.tr>)
List pgsql-performance
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
withouttime 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


pgsql-performance by date:

Previous
From: Justin Pryzby
Date:
Subject: Re: Gained %20 performance after disabling bitmapscan
Next
From: Vladimir Ryabtsev
Date:
Subject: Re: Gained %20 performance after disabling bitmapscan