On Thu, Jun 15, 2006 at 15:38:32 -0400, John Vincent <[EMAIL PROTECTED]> wrote: > Any suggestions? FYI the original question wasn't meant as a poke at > >comparing PG to MySQL to DB2. I'm not making an yvalue judgements either > >way. I'm just trying to understand how we can use it the best way possible. > > > > Actually we just thought about something. With PG, we can create an index > that is a SUM of the column where indexing, no? We're going to test this in > a few hours. Would that be able to be satisfied by an index scan?
No, that won't work. While you can make indexes on functions of a row, you can't make indexes on aggregate functions. You might find making a materialized view of the information you want can help with performance. The issues with "sum" are pretty much the same ones as with "count". You can find a couple different ways of doing materialized views for "count" in the archives. There is a simple way of doing it that doesn't work well with lots of concurrent updates and a more complicated method that does work well with lots of concurrent updates. ---------------------------(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