X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A93665E46CE for ; Tue, 31 Aug 2004 12:14:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50172-03 for ; Tue, 31 Aug 2004 15:14:45 +0000 (GMT) Received: from emepe3.com (unknown [69.93.218.52]) by svr1.postgresql.org (Postfix) with ESMTP id 6AC945E46C2 for ; Tue, 31 Aug 2004 12:14:37 -0300 (ADT) Received: from [200.89.130.112] (helo=[192.168.0.101]) by emepe3.com with asmtp (Exim 3.35 #1 (Debian)) id 1C2Ac1-0004cG-00; Tue, 31 Aug 2004 10:31:57 -0500 Subject: Re: seqscan instead of index scan From: Martin Sarsale To: Merlin Moncure Cc: pgsql-performance@postgresql.org In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A748E@Herge.rcsinc.local> References: <6EE64EF3AB31D5448D0007DD34EEB3412A748E@Herge.rcsinc.local> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-gY7hOLv6ofADkOdZsLUG" Organization: Emepe3.com Inc Message-Id: <1093965277.1680.93.camel@kadaif> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Tue, 31 Aug 2004 12:14:37 -0300 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/463 X-Sequence-Number: 8099 --=-gY7hOLv6ofADkOdZsLUG Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > Using a functional index you can define an index around the way you > access the data. There is no faster or better way to do it...this is a > mathematical truth, not a problem with the planner. Why not use the > right tool for the job? A boolean index is super-efficient both in disk > space and cache utilization. Thanks for your constructive criticism, you're absolutely right. I had to modify your "return" for a "select": create function rankeable (bigint, bigint) returns boolean as ' select case when $1 > 0 or $2 > 0 then true else false end;' language sql immutable; and it works great. --=-gY7hOLv6ofADkOdZsLUG Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQBBNJXchruVGj+ub3MRAnvaAJ9fbQ+OleKsjajgNBEfOsGVtcCl8gCgyMbU 1K7MaG89SKdCuDSbwMXBvFc= =7hx6 -----END PGP SIGNATURE----- --=-gY7hOLv6ofADkOdZsLUG--