Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TbFb0-00088K-OS for pgsql-performance@postgresql.org; Wed, 21 Nov 2012 19:04:26 +0000 Received: from dub0-omc4-s35.dub0.hotmail.com ([157.55.2.110]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TbFaw-00012z-SL for pgsql-performance@postgresql.org; Wed, 21 Nov 2012 19:04:24 +0000 Received: from DUB104-W33 ([157.55.2.72]) by dub0-omc4-s35.dub0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 21 Nov 2012 11:04:21 -0800 X-Originating-IP: [89.238.228.186] X-EIP: [b43zoxTz0guS22fPd6Ods5aZ7hpww30s] X-Originating-Email: [willem_leenen@hotmail.com] Message-ID: Content-Type: multipart/alternative; boundary="_cd56f545-b48d-4f83-9fa5-c4ae276a680a_" From: Willem Leenen CC: Subject: Re: Hints - experiences from other rdbms Date: Wed, 21 Nov 2012 19:04:20 +0000 Importance: Normal In-Reply-To: <50ACFBBD.30204@vmware.com> References: <20121121134232.68590@gmx.com>,<50ACFBBD.30204@vmware.com> MIME-Version: 1.0 X-OriginalArrivalTime: 21 Nov 2012 19:04:21.0145 (UTC) FILETIME=[03778890:01CDC81B] X-Pg-Spam-Score: -1.2 (-) X-Archive-Number: 201211/245 X-Sequence-Number: 48611 --_cd56f545-b48d-4f83-9fa5-c4ae276a680a_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable >=20 > Rather than telling the planner what to do or not to do=2C I'd much rathe= r=20 > have hints that give the planner more information about the tables and=20 > quals involved in the query. A typical source of bad plans is when the=20 > planner gets its cost estimates wrong. So rather than telling the=20 > planner to use a nested loop join for "a INNER JOIN b ON a.id =3D b.id"= =2C=20 > the user could tell the planner that there are only 10 rows that match=20 > the "a.id =3D b.id" qual.=20 Instead of gathering statistics for all possible joins ( and join orders) = =2C in Oracle there is a functionality that can be switched on where the op= timizer is given cardinality feedback for the chosen plans=2C so it can cho= ose another plan if the same statement comes around.=20 Secondly=2C there is functionality to insert a hint into an SQL statement. = That's very good for COTS apps where the statement can't be altered. Now I = know that there's relatively not much COTS for the Postgresql=2C ( hence ar= guments like 'we should not implement hints so we're forcing people to solv= e the underlying problem' )=2C but as Postgresql will replace oracle in the= lower end of the market=2C this functionality is usefull.=20 = --_cd56f545-b48d-4f83-9fa5-c4ae276a680a_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable


>=3B
>=3B Rather= than telling the planner what to do or not to do=2C I'd much rather
&g= t=3B have hints that give the planner more information about the tables and=
>=3B quals involved in the query. A typical source of bad plans is w= hen the
>=3B planner gets its cost estimates wrong. So rather than te= lling the
>=3B planner to use a nested loop join for "a INNER JOIN b = ON a.id =3D b.id"=2C
>=3B the user could tell the planner that there = are only 10 rows that match
>=3B the "a.id =3D b.id" qual.


Instead of gathering statistics for all possible joins ( and join ord= ers) =2C in Oracle there is a functionality that can be switched on where t= he optimizer is given cardinality feedback for the chosen plans=2C so it ca= n choose another plan if the same statement comes around.

Secondly= =2C there is functionality to insert a hint into an SQL statement. That's v= ery good for COTS apps where the statement can't be altered. Now I know tha= t there's relatively not much COTS for the Postgresql=2C ( hence arguments = like 'we should not implement hints so we're forcing people to solve the un= derlying problem' )=2C but as Postgresql will replace oracle in the lower e= nd of the market=2C this functionality is usefull.


=
= --_cd56f545-b48d-4f83-9fa5-c4ae276a680a_--