Joins or Temporary tables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • qhjghz
    New Member
    • Aug 2007
    • 26

    Joins or Temporary tables

    Hi,
    Am new to SQL Server. I have heard from "them" that in SQL Server it is better to temporarily store the result of 2 or more joins in a #table and then use it to join it with the other tables. Being from Oracle, I don't find it very logical. Can someone please help and explain...
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    As you have posted a question in the articles section it is being moved to SQL Server Forum.

    MODERATOR.

    Comment

    • azimmer
      Recognized Expert New Member
      • Jul 2007
      • 200

      #3
      Originally posted by qhjghz
      Hi,
      Am new to SQL Server. I have heard from "them" that in SQL Server it is better to temporarily store the result of 2 or more joins in a #table and then use it to join it with the other tables. Being from Oracle, I don't find it very logical. Can someone please help and explain...
      I have to disagree with "them": IMHO you can very well use joins "in the Oracle way". If the query or the join itself is very complex (e.g. contains many user-defined functions) and you have to run it very often, it is possible that performance-wise you are better off with a temp table (much like a materialized view in Oracle).

      Comment

      • qhjghz
        New Member
        • Aug 2007
        • 26

        #4
        Originally posted by azimmer
        I have to disagree with "them": IMHO you can very well use joins "in the Oracle way". If the query or the join itself is very complex (e.g. contains many user-defined functions) and you have to run it very often, it is possible that performance-wise you are better off with a temp table (much like a materialized view in Oracle).


        Thanks for your answer again. Can you please answer this one also? I have already pasted this as a separate query

        Need to know how does one find out the triggers present. I have executed this query to find it out

        select * From sysobjects where xtype='TR'

        It gives me the list, but I just want to know if there are any limitations of this query. Are there any better methods to find out the triggers?

        Comment

        • azimmer
          Recognized Expert New Member
          • Jul 2007
          • 200

          #5
          Originally posted by qhjghz
          Thanks for your answer again. Can you please answer this one also? I have already pasted this as a separate query

          Need to know how does one find out the triggers present. I have executed this query to find it out

          select * From sysobjects where xtype='TR'

          It gives me the list, but I just want to know if there are any limitations of this query. Are there any better methods to find out the triggers?
          I'm not sure what you mean by limitations; there's none I an think of. It's a decent way as far as I know.

          Comment

          • qhjghz
            New Member
            • Aug 2007
            • 26

            #6
            Originally posted by azimmer
            I'm not sure what you mean by limitations; there's none I an think of. It's a decent way as far as I know.
            Thankx for your reply

            Comment

            • qhjghz
              New Member
              • Aug 2007
              • 26

              #7
              Originally posted by azimmer
              I'm not sure what you mean by limitations; there's none I an think of. It's a decent way as far as I know.
              Thankx for your reply

              Comment

              Working...