On Fri, Nov 18, 2005 at 09:58:24AM -0500, Tom Lane wrote: > "Joshua D. Drake" <[EMAIL PROTECTED]> writes: > > It appears that predicate indexes won't uses indexes on int8 columns > > unless they are casted: > > This is a known (although perhaps not well documented) limitation of the > predicate testing logic. You do not need a cast in the query, though, > only in the index's WHERE condition.
I'm working on a docs patch for this (attached, but un-tested); is bigint the only datatype this applies to or are there others? -- Jim C. Nasby, Sr. Engineering Consultant [EMAIL PROTECTED] Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461
Index: doc/src/sgml/indices.sgml =================================================================== RCS file: /projects/cvsroot/pgsql/doc/src/sgml/indices.sgml,v retrieving revision 1.55 diff -u -r1.55 indices.sgml --- doc/src/sgml/indices.sgml 7 Nov 2005 17:36:44 -0000 1.55 +++ doc/src/sgml/indices.sgml 22 Nov 2005 00:30:55 -0000 @@ -525,6 +525,16 @@ feature, but there are several situations in which they are useful. </para> + <note> + <para> + Predicate indexes on bigint (<xref linkend="datatype-int">) columns will + not be used unless they are casted: +<programlisting> +CREATE INDEX foo ON test_key (id) WHERE id >= 50000::bigint; +</programlisting> + </para> + </note> + <para> One major reason for using a partial index is to avoid indexing common values. Since a query searching for a common value (one that
---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match