Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 6B8A792B8E9 for ; Thu, 5 Jul 2012 15:19:56 -0300 (ADT) Received: from mahout.postgresql.org ([98.129.198.123]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Smqeg-0000G3-E1 for pgsql-bugs@postgresql.org; Thu, 05 Jul 2012 18:19:55 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SmqeS-0000ND-6t for pgsql-bugs@postgresql.org; Thu, 05 Jul 2012 18:19:41 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1SmqeR-0000x3-RI for pgsql-bugs@postgresql.org; Thu, 05 Jul 2012 18:19:39 +0000 Date: Thu, 05 Jul 2012 18:19:39 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #6719: PG shouldn't filter on same criteria as index search To: pgsql-bugs@postgresql.org From: blove319@hotmail.com X-Pg-Spam-Score: -1.0 (-) X-Archive-Number: 201207/37 X-Sequence-Number: 33513 The following bug has been logged on the website: Bug reference: 6719 Logged by: BLove Email address: blove319@hotmail.com PostgreSQL version: 9.1.3 Operating system: Centos 5 Description: = 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. explain select * from transactions.subscriber_504700_txns_y2012m05 lh where lh.account_code LIKE '34016975\_DAT\_FR\_HF'; QUERY PLAN = ---------------------------------------------------------------------------= ------------------------------------------------------------------- Index Scan using idx_subscriber_504700_txns_y2012m05_account_code on subscriber_504700_txns_y2012m05 lh (cost=3D0.00..17.02 rows=3D3 width=3D13= 1) Index Cond: (account_code =3D '34016975_DAT_FR_HF'::text) Filter: (account_code ~~ '34016975\_DAT\_FR\_HF'::text)