SQL Server Performance

speeding up database queries agianst websites

Discussion in 'SQL Server 2008 General Developer Questions' started by lexius, Jan 20, 2010.

  1. lexius New Member

    Hi, good to find this site , looks really useful ;-)
    I have been developing databases for a few years now. Only once before now, have I written a databse for use over the net.
    My question is, if i have a table with say 10,000,000 records in for all the users of my site or which there are say 10,000. (1,000 records each)
    would it improve performance if I based my read queries (which is what most of them will be ) against a view that only has records on for logged on users.
    ie so if there are ony 100 users online then the view would be 100,000 record (100 users x 1,000 records)
    or should this not make any diference at all, this is what Im being told, but when some work beiofre on a web databse that was having performance issues this is what i did and it worked very well..
    its never been an issue when i have developed DBs before for office environrnments, but im designing a db from scratch for a web based app. I dont know if there are any tips or tricks to doing things differently over then net.
    thanks in advance for any tips/ comments

  2. FrankKalis Moderator

    Welcome to the forum!
    I don't think there will be an advantage of having a simple view in this case. A view is basically only a macro which will be expanded out to the underlying statement while processing. So, something like
    SELECT .... FROM MyVIEW WHERE UserName = somevalue
    and
    SELECT ...some more complicated SQL... FROM MyTables WHERE UserName = somevalue
    are essentially the same and the engine is likely to treat them equally.

Share This Page