On Fri, Sep 27, 2002 at 05:58:05PM +0300, Andriy Tkachuk wrote:
> On Fri, 27 Sep 2002, Martijn van Oosterhout wrote:
>
> > On Fri, Sep 27, 2002 at 01:28:13PM +0300, Andriy Tkachuk wrote:
> > > On Fri, 27 Sep 2002, Martijn van Oosterhout wrote:
> > > > What is the output of EXPLAIN ANALYSE <query>;
> > >
> > > There is EXPLAIN ANALYSE when query is heavy:
> >
> > Oookaaay. Your query is *evil*. 14 subqueries executed for *each* row of
> > output!?! I reackon you could improve your query just by rewriting it into a
> > better form. How can you have 10 subqueries to the same table?
>
> YES! You right!
> Just after restirong db i made vacuumdb -z -f
> and query become heavy!
>
> Does one have any ideas how to ovecome this!?
Firstly, how is calc_account() defined? Is it doing subqueries? If it is
then the planner won't be seeing them. Is it optimised?
calc_account (u.uid, 1030827600) as start_account,
calc_account (u.uid, 1032178388) as end_account,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.