Views (performance)

  • What the h3ck are you testing then if you're not ommiting some columns in one view that you are selecting in the other???

  • The size is varchar(100).

    I am omitting some columns, ofcourse.

    Heres the picture

    I have two tables

    T1 and T3, having similar structures.

    fname varchar(100)

    lname varchar(100)

    srno int (identity)

    In query I am omitting column T1LNAME and T3FNAME. Its the same as in the defn for view [t1t3limit].


    What I hear I forget, what I see I remember, what I do I understand

  • So you're querying from 2 different tables???

  • Thats right.

    CREATE view t1t3

    as

    select t1.srno as T1SRNO,t3.srno as T3SRNO,t1.fname as T1FNAME, t3.fname as T3Fname, t1.lname as T1Lname,t3.lname as T3Lname

    from t1 inner join t3 on t1.srno=t3.srno

     

    CREATE view t1t3limit

    as

    select t1.srno as T1SRNO,t3.srno as T3SRNO,t1.fname as T1FNAME, t3.fname as T3Fname

    from t1 inner join t3 on t1.srno=t3.srno

    =====================================================

    The select statement is

    select T1SRNO, T3SRNO,T1FNAME, T3Fname from t1t3

    select T1SRNO, T3SRNO,T1FNAME, T3Fname from t1t3limit

    When I execute the above query I get the variations in execution times.


    What I hear I forget, what I see I remember, what I do I understand

  • How about you use 1 view.

    Then select all fields from that view, then select all fields but 2-3 from that same view???

    Also make sure that the execution plans don't change between each selects.

  • If I do that, I get a variance of 5 secs. That is, if i select all the fields from t1t3 and if i select only 4 fields. But thats bound to happen. I want to know is is how does SQL Server query optimiser go about selecting the optimal execution plans for my scenario.

    BTW, thanks for your time and responses RGR'us. I appreciate that.


    What I hear I forget, what I see I remember, what I do I understand

  • HTH.

Viewing 7 posts - 16 through 21 (of 21 total)

You must be logged in to reply to this topic. Login to reply