Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id A7D3912B5666 for ; Thu, 5 Jul 2012 20:02:36 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Smv4E-0005LI-JL for pgsql-bugs@postgresql.org; Thu, 05 Jul 2012 23:02:35 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q65N2JjR002790; Thu, 5 Jul 2012 19:02:19 -0400 (EDT) From: Tom Lane To: blove319@hotmail.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #6719: PG shouldn't filter on same criteria as index search In-reply-to: References: Comments: In-reply-to blove319@hotmail.com message dated "Thu, 05 Jul 2012 18:19:39 -0000" Date: Thu, 05 Jul 2012 19:02:19 -0400 Message-ID: <2789.1341529339@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201207/38 X-Sequence-Number: 33514 blove319@hotmail.com writes: > After doing an equality search on an indexed field, PG is doing a filter on > the same value using a regex. That appears to be a useless operation that > will only consume cpu cycles. Getting rid of the filter expression isn't really worth the trouble. If we had done the transformation of regexes to index conditions in a different way, it might be practical to suppress the redundant test, but given the way the code is structured we can't easily. regards, tom lane