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. Stored Procedure Hell

Stored Procedure Hell

Scheduled Pinned Locked Moved The Weird and The Wonderful
database
15 Posts 8 Posters 0 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.
  • T Tim Carmichael

    Does the stored procedure do the job it was intended to do? Does it make business sense to decouple it and break it down into smaller pieces? If it works, and doesn't need to be decoupled, then where is the issue?

    S Offline
    S Offline
    Sentenryu
    wrote on last edited by
    #5

    Tim Carmichael wrote:

    then where is the issue?

    it takes 8 hours to run...

    R 1 Reply Last reply
    0
    • N Nicholas Marty

      Don't you know that stored procedures are the fastest possible way to do something on the database? Surely it doesn't matter how it is written. it still has to be faster than to do it in a more maintainable way :rolleyes:

      N Offline
      N Offline
      Nagy Vilmos
      wrote on last edited by
      #6

      Put that BACK!

      Nicholas Marty wrote:

      What?

      The pish you just took! :laugh: :laugh: :laugh:

      speramus in juniperus

      R 1 Reply Last reply
      0
      • M Max Methot

        I agree with your argument of being the fastest way to interact with the database data, but it also means the business logic stays in the database and is higly coupled with the db system. In an evolutive world as the one we live in, this is not recommended, although this is probably a system from a big corp that was built on older paradigms. At this point, they probably have no other choice. :)

        R Offline
        R Offline
        Rob Grainger
        wrote on last edited by
        #7

        I'd be hard pushed to describe any of this as logic!

        "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

        1 Reply Last reply
        0
        • T Tim Carmichael

          Does the stored procedure do the job it was intended to do? Does it make business sense to decouple it and break it down into smaller pieces? If it works, and doesn't need to be decoupled, then where is the issue?

          R Offline
          R Offline
          Rob Grainger
          wrote on last edited by
          #8

          At present it kind of works. Our system deals with a number of types of object, if a new type is added, we will need to maintain it. Nobody has been brave enough to tackle the thing, and no one really understands how it works. But apart from that, all is hunky dory.

          "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

          N 1 Reply Last reply
          0
          • M Max Methot

            I agree with your argument of being the fastest way to interact with the database data, but it also means the business logic stays in the database and is higly coupled with the db system. In an evolutive world as the one we live in, this is not recommended, although this is probably a system from a big corp that was built on older paradigms. At this point, they probably have no other choice. :)

            R Offline
            R Offline
            Rob Grainger
            wrote on last edited by
            #9

            Actually, the little bit I looked at today had rafts of queries of the form..

            INSERT INTO TEMPTABLE (A, B, C, D, 'OBJ TYPE 1')
            SELECT A, B, C, D
            FROM MASTERTABLE
            WHERE OBJTYPE = 1 ' OBJ TYPE 1

            INSERT INTO TEMPTABLE (A, B, C, D, 'OBJ TYPE 2')
            SELECT A, B, C, D
            FROM MASTERTABLE
            WHERE OBJTYPE = 2 ' OBJ TYPE 2

            (without the comment. Theres absolutely zero comments) Rinse and repeat for a further 13 object types, then apply a set of 15 update queries to the result based on other selections based on the same types. If I ever have to get my hands dirty, I'll begin by refactoring those out to other procedures, and use a parameter to specify the object type - that's if I can't do the same thing more efficiently by GROUP BY in some way. Hopefully after a while some wood will begin to emerge from the trees.

            "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

            1 Reply Last reply
            0
            • N Nagy Vilmos

              Put that BACK!

              Nicholas Marty wrote:

              What?

              The pish you just took! :laugh: :laugh: :laugh:

              speramus in juniperus

              R Offline
              R Offline
              Rob Grainger
              wrote on last edited by
              #10

              I was further amazed to discover the guy who wrote it (used to work for a third party who used to do the development) now works for Microsoft! I did joke that maybe his job is to push their query optimisation team to the limits. ;)

              "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

              V 1 Reply Last reply
              0
              • S Sentenryu

                Tim Carmichael wrote:

                then where is the issue?

                it takes 8 hours to run...

                R Offline
                R Offline
                Rob Grainger
                wrote on last edited by
                #11

                Apparently, about 18 months ago it took a couple of hours. At this rate, we soon won't be able to run it overnight, as our database doesn't tend to get smaller over time!

                "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                J 1 Reply Last reply
                0
                • R Rob Grainger

                  Apparently, about 18 months ago it took a couple of hours. At this rate, we soon won't be able to run it overnight, as our database doesn't tend to get smaller over time!

                  "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

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

                  Is the growth in execution time linear or exponential?

                  Politicians are always realistically manoeuvering for the next election. They are obsolete as fundamental problem-solvers. Buckminster Fuller

                  R 1 Reply Last reply
                  0
                  • R Rob Grainger

                    At present it kind of works. Our system deals with a number of types of object, if a new type is added, we will need to maintain it. Nobody has been brave enough to tackle the thing, and no one really understands how it works. But apart from that, all is hunky dory.

                    "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                    N Offline
                    N Offline
                    Nicholas Marty
                    wrote on last edited by
                    #13

                    Just call it magic and back off slowly. :laugh: And don't turn your back on it until you're out of sight!! :D

                    1 Reply Last reply
                    0
                    • J Jorgen Andersson

                      Is the growth in execution time linear or exponential?

                      Politicians are always realistically manoeuvering for the next election. They are obsolete as fundamental problem-solvers. Buckminster Fuller

                      R Offline
                      R Offline
                      Rob Grainger
                      wrote on last edited by
                      #14

                      I don't know yet, I only have 2 data points. (and one of them is fairly rough - I only know exactly for the latest few runs)

                      "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                      1 Reply Last reply
                      0
                      • R Rob Grainger

                        I was further amazed to discover the guy who wrote it (used to work for a third party who used to do the development) now works for Microsoft! I did joke that maybe his job is to push their query optimisation team to the limits. ;)

                        "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                        V Offline
                        V Offline
                        Vasudevan Deepak Kumar
                        wrote on last edited by
                        #15

                        Rob Grainger wrote:

                        now works for Microsoft

                        How about nominating him here? http://www.nextmicrosoftceo.com/[^]

                        Vasudevan Deepak Kumar Personal Homepage You can not step into the same river twice.

                        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