5 Replies Latest reply on Nov 12, 2009 9:02 AM by James Baker

    Custom SQL for context date filters

    . bcotton

      I'm using postgres for a datawarehouse. We are using table partitioning (by timestamp, by month) for the fact tables.

      In order to get postgres to not query all the partitions in the database, you need to include in the where clause something like:

       

      WHERE timestamp between '1-1-2009'::timestamp and '2-1-2009'::timestamp

       

      tableau emits this for a context query:

       

      WHERE ((CAST(EXTRACT(MONTH FROM timestamp) AS INTEGER)) = 1)

       

      This where clause will not cause the optimizer to Do The Right Thing.

       

      Any ideas how to proceed?

       

      Thanks

      -Bob