On Fri, Jul 08, 2005 at 16:49:44 +0200,
  PFC <[EMAIL PROTECTED]> wrote:
> 
> >>SELECT (SELECT sum(amount) FROM table WHERE debit=X) AS debit, (SELECT
> >>sum(amount) FROM table WHERE credit=x) AS credit;
> >
> >If most of the records are credits or debits you don't want to do this.
> >A single sequential scan through the table will be the best plan.
> 
>       I thought that debit = source account # and credit = dest account #, 
>       and  there are a lot of different account...

You aren't likely to see a significant speed up in that case either.

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to