Re: [HACKERS] Why is that so slow?

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane)
Cc: hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Why is that so slow?
Date: 1999-03-07 17:28:33
Message-ID: 199903071728.MAA21613@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Well, it's right at the instant of creation, but I think that's much too
> simplistic a way of looking at it. Tables are generally created with
> the intention of putting data into them. It's a reasonable assumption
> that the table will shortly have some rows in it.
>
> Now, any particular estimate like 1000 is obviously going to be wrong.
> The point I'm trying to make is that the optimizer is more likely to
> generate a sane plan if it assumes that the table contains a moderate
> number of rows. We have seen gripes time and time again from people
> who made a table, didn't bother to do a vacuum, and got horribly slow
> nested-loop plans from the optimizer because it assumed their table
> was empty. With a nonzero initial estimate, the optimizer will choose
> a plan that might be somewhat inefficient if the table really is small;
> but it won't be seriously unusable if the table is large.
>
> Once you've done a vacuum, of course, the whole question is moot.
> But I think the system's behavior would be more robust if it assumed
> that a never-yet-vacuumed table contained some rows, not no rows.

True, but the new optimizer code favors ordered/mergejoin over nested
loop because it favors ordered results over unordered ones like nested
loop. Should fix the problem.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-03-07 18:53:54 6.4.3 release
Previous Message Tom Lane 1999-03-07 17:00:04 Re: [HACKERS] Why is that so slow?