Re: Are selects defined in view faster than run-time selects?

From: David Cressey <david_at_dcressey.com>
Date: Mon, 08 Apr 2002 13:45:30 GMT
Message-ID: <_9hs8.13$HK3.1129_at_petpeeve.ziplink.net>


> If you see a view as a stored SELECT-statement with a name, without
> any physical representation...then there's no reason for a view to be
> faster.

It depends. Some RDBMS engines "compile" views, much like compiling procedures. Compiling a view
often implies coming up with an execution plan. This can cut both ways. If the execution plan is a good one, at actual execution time, then we get a fast running view, and we save the amount of time needed to determine the execution plan. For very complicated views, this can be significant.

However, if the compiled execution plan turns out to be a bad one at execution time, then the view can exhibit lousy performance. How can this happen? In addition to unfortunate choice by the optimizer, there's the case of the misinformed optimizer, where the optimizer has been misled about the probable cost of various lookup paths.

--
Regards,
    David Cressey
    www.dcressey.com
Received on Mon Apr 08 2002 - 15:45:30 CEST

Original text of this message