| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: using views in select statements
I look at views as if they are just a "stored SQL statement". One of the
advantages of this is that once a view is created, its statement is stored.
Once Oracle parses that statement, any other references to that view will be
already parsed.
By explicitly running the sql statement every time, you run the risk of the added time of oracle having to re-parse your sql statement. In order for 2 sql statements to match, they must be IDENTICAL in everty asspect: spaces, upper vs lower case, etc. If anything is even remotely different, it is treated as a different query and the statement is parsed. Parsing is usually quick, but it is an extra step Oracle has to do.
Another option you may want to look at is Snapshots. If your queriey is a complicated one or returns many rows, you may want to run it as a snapshot. The results of the query are put into the snapshot at a regular basis, and you can reference the snapshot just as you would any table or view. I believe there is lots of documentation in the Oracle Admin manuals on snapshots.
kal121_at_yahoo.com wrote:
> Hello all,
>
> What is the general opinion of using views instead of tables in a query?
>
> For example, is it better to run a query against four separate tables or
> against a single view that already contains the relevant columns from
> those four tables? I know it is hard to answer this without seeing the
> query(s), but I'd just like a general opinion on this.
>
> Thanks
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Thu Oct 21 1999 - 12:54:50 CDT
![]() |
![]() |