Professional Web Applications Themes

JOINs in Views - Microsoft SQL / MS SQL Server

Hi group! I'd like to know the following: If I define a view that JOINs several tables, then query this view and only select a few of the columns so that not all tables are needed, will the JOIN still be done with all the tables? The point is, sometimes I only need a few columns (not always the same ones), sometimes all. Is it ok just to create this one view that has it all, or will performance be better if I create a tailored view for each query I have? Thanks, Martin...

  1. #1

    Default JOINs in Views

    Hi group!

    I'd like to know the following:
    If I define a view that JOINs several tables, then query this view and only
    select a few of the columns so that not all tables are needed, will the JOIN
    still be done with all the tables?
    The point is, sometimes I only need a few columns (not always the same
    ones), sometimes all. Is it ok just to create this one view that has it all,
    or will performance be better if I create a tailored view for each query I
    have?

    Thanks,
    Martin


    Martin Lingl Guest

  2. #2

    Default JOINs in Views

    If storage space is not the issue you could create an
    indexed view (which physically stores te data) but can
    greatly improve performance

    GL

    Jorge
    >-----Original Message-----
    >Hi group!
    >
    >I'd like to know the following:
    >If I define a view that JOINs several tables, then query
    this view and only
    >select a few of the columns so that not all tables are
    needed, will the JOIN
    >still be done with all the tables?
    >The point is, sometimes I only need a few columns (not
    always the same
    >ones), sometimes all. Is it ok just to create this one
    view that has it all,
    >or will performance be better if I create a tailored
    view for each query I
    >have?
    >
    >Thanks,
    >Martin
    >
    >
    >.
    >
    jorge Guest

  3. #3

    Default Re: JOINs in Views

    The JOIN will still be done using all the tables, so it is best for
    performance to create separate views if you only need a few columns from a
    few tables.

    --
    Jacco Schalkwijk MCDBA, MCSD, MCSE
    Database Administrator
    Eurostop Ltd.


    "Martin Lingl" <martinlinglchello.at> wrote in message
    news:#hu$egeRDHA.3192tk2msftngp13.phx.gbl...
    > Hi group!
    >
    > I'd like to know the following:
    > If I define a view that JOINs several tables, then query this view and
    only
    > select a few of the columns so that not all tables are needed, will the
    JOIN
    > still be done with all the tables?
    > The point is, sometimes I only need a few columns (not always the same
    > ones), sometimes all. Is it ok just to create this one view that has it
    all,
    > or will performance be better if I create a tailored view for each query I
    > have?
    >
    > Thanks,
    > Martin
    >
    >

    Jacco Schalkwijk Guest

  4. #4

    Default JOINs in Views

    You might create a stored proc that does modularized code.

    Rough idea:

    If var1 and var2 are not null, run this stored proc, else
    run this stored proc, I would hesitate to create one
    massive view to get everything as you make all of the
    performance of your queries the lowest common denominator.

    If you want more explicit help, post your view code and
    how you may call it.

    HTH

    Ray Higdon MCSE, MCDBA, CCNA

    >-----Original Message-----
    >Hi group!
    >
    >I'd like to know the following:
    >If I define a view that JOINs several tables, then query
    this view and only
    >select a few of the columns so that not all tables are
    needed, will the JOIN
    >still be done with all the tables?
    >The point is, sometimes I only need a few columns (not
    always the same
    >ones), sometimes all. Is it ok just to create this one
    view that has it all,
    >or will performance be better if I create a tailored view
    for each query I
    >have?
    >
    >Thanks,
    >Martin
    >
    >
    >.
    >
    Ray Higdon Guest

Similar Threads

  1. Alternative joins
    By Murdoc in forum MySQL
    Replies: 0
    Last Post: August 18th, 10:31 AM
  2. joins in mysql
    By Marcus in forum MySQL
    Replies: 2
    Last Post: August 5th, 08:16 PM
  3. JOINs instead of AND
    By Jim Michaels in forum MySQL
    Replies: 1
    Last Post: March 11th, 02:26 AM
  4. SQL help on joins
    By zCrow in forum Dreamweaver AppDev
    Replies: 3
    Last Post: May 10th, 09:17 PM
  5. Replies: 4
    Last Post: July 8th, 07:00 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139