> Is there a good reason why rdbms don't just keep a cache of decisions on
> this stuff. I realise SQL is supposed to be ad-hoc but in reality, it's the
> old 90:10 rule where a handful of queries get run consistently and where
> performance is important.
>
> Why doesn't PG (or any other system afaik) just have a first guess, run the
> query and then if the costs are horribly wrong cache the right result. I'm
> guessing there's a bloody good reason (TM) for it since query planning has
> got to be equivalent to least-cost path so NP (NP-Complete? I forget - too
> long out of college).
I have asked about this before. Decisions about sequential/index scans
could be theoretically fed from the executor back to the optimizer for
later user.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026