Re: Planner question - "bit" data types - Mailing list pgsql-performance

From Bruce Momjian
Subject Re: Planner question - "bit" data types
Date
Msg-id 201002230247.o1N2lTe15332@momjian.us
Whole thread Raw
In response to Re: Planner question - "bit" data types  (Bruce Momjian <bruce@momjian.us>)
List pgsql-performance
Bruce Momjian wrote:
> Alvaro Herrera wrote:
> > Karl Denninger escribi?:
> >
> > > The individual boolean fields don't kill me and in terms of some of the
> > > application issues they're actually rather easy to code for.
> > >
> > > The problem with re-coding for them is extensibility (by those who
> > > install and administer the package); a mask leaves open lots of extra
> > > bits for "site-specific" use, where hard-coding booleans does not, and
> > > since the executable is a binary it instantly becomes a huge problem for
> > > everyone but me.
> >
> > Did you try hiding the bitmask operations inside a function as Tom
> > suggested?
>
> Yes.  In addition, functions that are part of expression indexes do get
> their own optimizer statistics, so it does allow you to get optimizer
> stats for your test without having to use booleans.
>
> I see this documented in the 8.0 release notes:
>
>      * "ANALYZE" now collects statistics for expression indexes (Tom)
>        Expression indexes (also called functional indexes) allow users
>        to index not just columns but the results of expressions and
>        function calls. With this release, the optimizer can gather and
>        use statistics about the contents of expression indexes. This will
>        greatly improve the quality of planning for queries in which an
>        expression index is relevant.
>
> Is this in our main documentation somewhere?

Added with attached, applied patch.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +
Index: doc/src/sgml/maintenance.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v
retrieving revision 1.99
diff -c -c -r1.99 maintenance.sgml
*** doc/src/sgml/maintenance.sgml    8 Feb 2010 04:33:51 -0000    1.99
--- doc/src/sgml/maintenance.sgml    23 Feb 2010 02:46:21 -0000
***************
*** 318,323 ****
--- 318,331 ----
       SET STATISTICS</>, or change the database-wide default using the <xref
       linkend="guc-default-statistics-target"> configuration parameter.
      </para>
+
+     <para>
+      Also, by default there is limited information available about
+      the selectivity of functions.  However, if you create an expression
+      index that uses a function call, useful statistics will be
+      gathered about the function, which can greatly improve query
+      plans that use the expression index.
+     </para>
     </tip>
    </sect2>


pgsql-performance by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: SSD + RAID
Next
From: Dave Crooke
Date:
Subject: Advice requested on structuring aggregation queries