Venki Ramachandran <venki_ramachandran@xxxxxxxxx> wrote: > I have PostGres 9.0 database in a AWS server (x-large) and a > pgplsql program that does some computation. It takes in a date > range and for one pair of personnel (two employees in a company) > it calculates some values over the time period. It takes about > 40ms (milli seconds) to complete and give me the answer. All good > so far. Maybe; maybe not. If you wrote out *how to do it* in your code, it probably won't scale well. The trick to scaling is to write *declaratively*: say *what you want* rather than *how to get it*. Aggregates, window functions, CTEs, and/or the generate_series() function may be useful. It's hard to give more specific advice without more detail about the problem. -Kevin -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance