Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gDVCF-0001yD-DE for pgsql-performance@arkaria.postgresql.org; Fri, 19 Oct 2018 13:52:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gDVCD-0002P3-GT for pgsql-performance@arkaria.postgresql.org; Fri, 19 Oct 2018 13:52:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gDVCD-0002Ow-8q for pgsql-performance@lists.postgresql.org; Fri, 19 Oct 2018 13:52:09 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gDVCA-0007Xj-U0 for pgsql-performance@lists.postgresql.org; Fri, 19 Oct 2018 13:52:08 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w9JDq447031173; Fri, 19 Oct 2018 09:52:04 -0400 From: Tom Lane To: Yavuz Selim Sertoglu cc: "pgsql-performance@lists.postgresql.org" Subject: Re: Gained %20 performance after disabling bitmapscan In-reply-to: References: Comments: In-reply-to Yavuz Selim Sertoglu message dated "Fri, 19 Oct 2018 07:19:12 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31171.1539957124.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 19 Oct 2018 09:52:04 -0400 Message-ID: <31172.1539957124@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Yavuz Selim Sertoglu 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 =3D '0123456789'::text) AND (k= ayit_tarihi >=3D '2018-01-01 00:00:00'::timestamp without time zone) AND (= sube_no =3D '-13'::integer) AND ((defter)::text =3D '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