[dba-SQLServer] Views

Arthur Fuller fuller.artful at gmail.com
Tue Oct 7 15:00:23 CDT 2008


Didn't I already answer that question, Susan? Views are a wonderful
convenience if you have a smallish number of rows, but the overhead
seriously adds up when you pass, say, 50K rows in a table -- let alone 50M
rows.

SELECT * FROM MyView WHERE PK = 124

results in the case of a view that all rows in the view are sent to the
client and then the client filters the result set. By contrast, a sproc that
accepts a @PK parameter will execute on the server and transmit only the
result set over the pipe, This could be a difference of hundreds of
thousands or even millions of rows. Multiply that by the number of users.

Views are cute and fun, but essentially stupid. That said, I build them all
the time, because I get to use the designer to build them, but then I save
them and grab the SQL generated by the designer and turn it into a
parameterized sproc or table udf.

A.

On Tue, Oct 7, 2008 at 3:23 PM, Susan Harkins <ssharkins at gmail.com> wrote:

> Why?
>
> Susan H.
>
>
>



More information about the dba-SQLServer mailing list