Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlDxX-0003lW-PC for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Jul 2019 14:52:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hlDxV-0008K8-H9 for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Jul 2019 14:52:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlDxV-0008Hi-53 for pgsql-hackers@lists.postgresql.org; Wed, 10 Jul 2019 14:52:37 +0000 Received: from smtp03.optiver.com ([195.246.114.70]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlDxS-0003xh-J8 for pgsql-hackers@postgresql.org; Wed, 10 Jul 2019 14:52:35 +0000 Received: from pps.filterd (smtp03.optiver.com [127.0.0.1]) by smtp03.optiver.com (8.16.0.27/8.16.0.27) with SMTP id x6AEppC7025209; Wed, 10 Jul 2019 16:52:21 +0200 Received: from opammb0562.comp.optiver.com (opammb0562.comp.optiver.com [10.131.160.2]) by smtp03.optiver.com with ESMTP id 2tjh85t7d6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 10 Jul 2019 16:52:21 +0200 Received: from opammb0561.comp.optiver.com (10.131.160.1) by opammb0562.comp.optiver.com (10.131.160.2) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 10 Jul 2019 16:52:21 +0200 Received: from opammb0561.comp.optiver.com ([fe80::9d46:f4ee:846a:2858]) by opammb0561.comp.optiver.com ([fe80::9d46:f4ee:846a:2858%17]) with mapi id 15.00.1473.003; Wed, 10 Jul 2019 16:52:21 +0200 From: Floris Van Nee To: Dmitry Dolgov <9erthalion6@gmail.com>, David Rowley , Jesper Pedersen CC: Thomas Munro , James Coleman , Rafia Sabih , Jeff Janes , Peter Geoghegan , Tomas Vondra , Thomas Munro , Bhushan Uparkar , PostgreSQL-development , Alexander Korotkov Thread-Topic: Index Skip Scan [External] Thread-Index: AQHVNy6RLAtiFzr100OCkk9u6dFk6KbD7v6w Date: Wed, 10 Jul 2019 14:52:21 +0000 Message-ID: <1562770342222.94509@Optiver.com> References: <2685f020-f302-9bf6-1b5c-ebc2bcebc635@2ndquadrant.com> <1559361698401.22864@Optiver.com> <1559362223126.18661@Optiver.com> <988b7763-5c55-1be1-b7b6-f3a68eff0d40@redhat.com> <1559763453006.85615@Optiver.com> <1559763570329.85227@Optiver.com> <4d469bf2-49ff-bc3d-a428-6c7b5d87d526@redhat.com> <1562769595280.16860@Optiver.com>, In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.131.160.182] x-tm-as-product-ver: SMEX-11.0.0.1284-8.100.1062-24750.007 x-tm-as-result: No-2.879200-0.000000-31 x-tm-as-user-approved-sender: Yes x-tm-as-user-blocked-sender: No Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: Index Skip Scan X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-07-10_06:,, signatures=0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =0A= > Thanks for testing! Could you provide a test case to show what exactly is= the=0A= > problem?=0A= =0A= create table a (a int, b int, c int);=0A= insert into a (select vs, ks, 10 from generate_series(1,5) vs, generate_ser= ies(1, 10000) ks);=0A= create index on a (a,b);=0A= analyze a;=0A= =0A= set enable_indexskipscan=3D1; // setting this to 0 yields different results= =0A= set random_page_cost=3D1;=0A= explain SELECT DISTINCT ON (a) a,b FROM a;=0A= =0A= BEGIN;=0A= DECLARE c SCROLL CURSOR FOR SELECT DISTINCT ON (a) a,b FROM a;=0A= =0A= FETCH FROM c;=0A= FETCH BACKWARD FROM c;=0A= =0A= FETCH 6 FROM c;=0A= FETCH BACKWARD 6 FROM c;=0A= =0A= FETCH 6 FROM c;=0A= FETCH BACKWARD 6 FROM c;=0A= =0A= END;=0A=