Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. "This is a rare event"

"This is a rare event"

Scheduled Pinned Locked Moved The Weird and The Wonderful
databasecsharpasp-netsql-serverdotnet
14 Posts 11 Posters 50 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Slacker007

    I believe SQL Server has a maximum query memory of 2 gigs. You obviously surpassed that with all the unions. I believe all unions are read into memory. I am guessing here, I could be wrong.

    J Offline
    J Offline
    jsc42
    wrote on last edited by
    #3

    Strawbs - Part Of The Union - YouTube[^]

    1 Reply Last reply
    0
    • M Marc Clifton

      For giggles I programmatically created a query that had a huge number of unions. The full message from SQL Server was:

      Quote:

      The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions.

      :laugh:

      Latest Article:
      Create a Digital Ocean Droplet for .NET Core Web API with a real SSL Certificate on a Domain

      M Offline
      M Offline
      MarkTJohnson
      wrote on last edited by
      #4

      There are also only 100 levels of recursion in a cursor. Found that out in the poast two weeks when a client's process failed on a stored procedure that was last edited a decade ago.

      I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.

      P 1 Reply Last reply
      0
      • M MarkTJohnson

        There are also only 100 levels of recursion in a cursor. Found that out in the poast two weeks when a client's process failed on a stored procedure that was last edited a decade ago.

        I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #5

        Or a recursive CTE, but you can increase that I think.

        1 Reply Last reply
        0
        • M Marc Clifton

          For giggles I programmatically created a query that had a huge number of unions. The full message from SQL Server was:

          Quote:

          The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions.

          :laugh:

          Latest Article:
          Create a Digital Ocean Droplet for .NET Core Web API with a real SSL Certificate on a Domain

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #6

          I never make a large JOIN , I split it up: A JOIN B JOIN C JOIN D becomes: ( ( A JOIN B ) JOIN C ) JOIN D

          M C 2 Replies Last reply
          0
          • P PIEBALDconsult

            I never make a large JOIN , I split it up: A JOIN B JOIN C JOIN D becomes: ( ( A JOIN B ) JOIN C ) JOIN D

            M Offline
            M Offline
            Marc Clifton
            wrote on last edited by
            #7

            Oh that's interesting! I'll have to try that!

            Latest Article:
            Create a Digital Ocean Droplet for .NET Core Web API with a real SSL Certificate on a Domain

            J 1 Reply Last reply
            0
            • M Marc Clifton

              For giggles I programmatically created a query that had a huge number of unions. The full message from SQL Server was:

              Quote:

              The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions.

              :laugh:

              Latest Article:
              Create a Digital Ocean Droplet for .NET Core Web API with a real SSL Certificate on a Domain

              D Offline
              D Offline
              Duncan Edwards Jones
              wrote on last edited by
              #8

              This message is only shown to the SELECT few...

              pkfoxP 1 Reply Last reply
              0
              • M Marc Clifton

                Oh that's interesting! I'll have to try that!

                Latest Article:
                Create a Digital Ocean Droplet for .NET Core Web API with a real SSL Certificate on a Domain

                J Offline
                J Offline
                Jorgen Andersson
                wrote on last edited by
                #9

                For inner joins the optimizer will disregard any order of the joins, or any parentheses for that matter. If you want to force a specific order there's a hint for that: OPTION (FORCE ORDER) For outer joins this is not the case, they will happen in the relative order specified.

                Wrong is evil and must be defeated. - Jeff Ello

                1 Reply Last reply
                0
                • P PIEBALDconsult

                  I never make a large JOIN , I split it up: A JOIN B JOIN C JOIN D becomes: ( ( A JOIN B ) JOIN C ) JOIN D

                  C Offline
                  C Offline
                  Craig Robbins
                  wrote on last edited by
                  #10

                  Question for you? Can you verify this 1) uses less memory and/or 2) improves performance time? Thanks! Craig

                  P 1 Reply Last reply
                  0
                  • C Craig Robbins

                    Question for you? Can you verify this 1) uses less memory and/or 2) improves performance time? Thanks! Craig

                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote on last edited by
                    #11

                    It has significantly reduced execution time in many cases. Your mileage will vary.

                    1 Reply Last reply
                    0
                    • D Duncan Edwards Jones

                      This message is only shown to the SELECT few...

                      pkfoxP Offline
                      pkfoxP Offline
                      pkfox
                      wrote on last edited by
                      #12

                      That's bang out of ORDER ;P

                      Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP

                      1 Reply Last reply
                      0
                      • M Marc Clifton

                        For giggles I programmatically created a query that had a huge number of unions. The full message from SQL Server was:

                        Quote:

                        The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions.

                        :laugh:

                        Latest Article:
                        Create a Digital Ocean Droplet for .NET Core Web API with a real SSL Certificate on a Domain

                        M Offline
                        M Offline
                        Member 15078716
                        wrote on last edited by
                        #13

                        What version of SQL was that? What was the count of unions that caused this? Thank you.

                        1 Reply Last reply
                        0
                        • M Marc Clifton

                          For giggles I programmatically created a query that had a huge number of unions. The full message from SQL Server was:

                          Quote:

                          The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions.

                          :laugh:

                          Latest Article:
                          Create a Digital Ocean Droplet for .NET Core Web API with a real SSL Certificate on a Domain

                          R Offline
                          R Offline
                          Ron Anders
                          wrote on last edited by
                          #14

                          Which means "Stop doing this to us in here!" :mad: Just for more gig-gles, sent it over and over and see is the "rare event" message changes.

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups