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. Must....not....kill....

Must....not....kill....

Scheduled Pinned Locked Moved The Weird and The Wonderful
pythoncomperformancelearning
26 Posts 18 Posters 3 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.
  • M Marc Clifton

    a = cx.ExecuteQuery("select top (1) a from foo where id={0}", id).First();
    b = cx.ExecuteQuery("select top (1) b from foo where id={0}", id).First();
    c = cx.ExecuteQuery("select top (1) c from foo where id={0}", id).First();

    ... and about 20 more of those, yes, each effectively querying a scalar from foo with the same qualifier. Major redaction in the above, but you get the idea. So many things wrong about this. And people here wonder why the performance of nightly jobs is so bad. :((

    Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #6

    That's why we're expensive :-D

    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

    1 Reply Last reply
    0
    • M Marc Clifton

      a = cx.ExecuteQuery("select top (1) a from foo where id={0}", id).First();
      b = cx.ExecuteQuery("select top (1) b from foo where id={0}", id).First();
      c = cx.ExecuteQuery("select top (1) c from foo where id={0}", id).First();

      ... and about 20 more of those, yes, each effectively querying a scalar from foo with the same qualifier. Major redaction in the above, but you get the idea. So many things wrong about this. And people here wonder why the performance of nightly jobs is so bad. :((

      Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

      D Offline
      D Offline
      den2k88
      wrote on last edited by
      #7

      The whole code I'm working on right now is like that but worse.

      GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

      1 Reply Last reply
      0
      • M Marc Clifton

        a = cx.ExecuteQuery("select top (1) a from foo where id={0}", id).First();
        b = cx.ExecuteQuery("select top (1) b from foo where id={0}", id).First();
        c = cx.ExecuteQuery("select top (1) c from foo where id={0}", id).First();

        ... and about 20 more of those, yes, each effectively querying a scalar from foo with the same qualifier. Major redaction in the above, but you get the idea. So many things wrong about this. And people here wonder why the performance of nightly jobs is so bad. :((

        Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

        S Offline
        S Offline
        Slacker007
        wrote on last edited by
        #8

        Subject: Must....not....kill....

        you can always claim self-defense.

        M 1 Reply Last reply
        0
        • R RickZeeland

          Listen to this and you will feel better: Adamski & Seal - Killer (Original Video Clip) - YouTube[^]

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

          RickZeeland wrote:

          Listen to this and you will feel better: Adamski & Seal -

          Restricted at work. :laugh: It'll have to wait until I get home.

          Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

          1 Reply Last reply
          0
          • S Slacker007

            Subject: Must....not....kill....

            you can always claim self-defense.

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

            Slacker007 wrote:

            you can always claim self-defense.

            No, this would be obvious murder. Mercy killing, granted, but still killing. :rolleyes:

            Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

            G 1 Reply Last reply
            0
            • S Sacha Barber

              Adamski actually met that guy he was cool

              R Offline
              R Offline
              RickZeeland
              wrote on last edited by
              #11

              Haven't heard much of him after his hit with "Killer", I wonder what has become of him ...

              1 Reply Last reply
              0
              • M megaadam

                I think what he needs is something more like this: Rage Against The Machine - Killing In the Name - YouTube[^]

                R Offline
                R Offline
                RickZeeland
                wrote on last edited by
                #12

                Relaxing, that's just what Marc needs :-\

                1 Reply Last reply
                0
                • M Marc Clifton

                  a = cx.ExecuteQuery("select top (1) a from foo where id={0}", id).First();
                  b = cx.ExecuteQuery("select top (1) b from foo where id={0}", id).First();
                  c = cx.ExecuteQuery("select top (1) c from foo where id={0}", id).First();

                  ... and about 20 more of those, yes, each effectively querying a scalar from foo with the same qualifier. Major redaction in the above, but you get the idea. So many things wrong about this. And people here wonder why the performance of nightly jobs is so bad. :((

                  Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                  C Offline
                  C Offline
                  charlieg
                  wrote on last edited by
                  #13

                  Marc/others - be gentle with me ;). This is what, C#? So someone seriously got carried away with cut and paste... Did I understand your rant correctly?

                  Charlie Gilley <italic>Stuck in a dysfunctional matrix from which I must escape... "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759

                  M 1 Reply Last reply
                  0
                  • M Marc Clifton

                    a = cx.ExecuteQuery("select top (1) a from foo where id={0}", id).First();
                    b = cx.ExecuteQuery("select top (1) b from foo where id={0}", id).First();
                    c = cx.ExecuteQuery("select top (1) c from foo where id={0}", id).First();

                    ... and about 20 more of those, yes, each effectively querying a scalar from foo with the same qualifier. Major redaction in the above, but you get the idea. So many things wrong about this. And people here wonder why the performance of nightly jobs is so bad. :((

                    Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                    B Offline
                    B Offline
                    Bernhard Hiller
                    wrote on last edited by
                    #14

                    No no no! Do not change that, you'll break it! Don't you see that the other fields in that row of the table might change between queries? There's no transaction around these queries after all! And also the id parameter might change between queries, if a different process has write access to it. Oh, another thing: are you sure that the id column of the table is unique? So many things could go wrong with your refactoring. Better don't do that! You cannot find out what the original developer thought when he wrote that code thanks to a lack of proper documentation. :-D

                    Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!

                    M 1 Reply Last reply
                    0
                    • M Marc Clifton

                      Slacker007 wrote:

                      you can always claim self-defense.

                      No, this would be obvious murder. Mercy killing, granted, but still killing. :rolleyes:

                      Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                      G Offline
                      G Offline
                      Gary Wheeler
                      wrote on last edited by
                      #15

                      I prefer to think of it as giving natural selection a helping hand.

                      Software Zen: delete this;

                      1 Reply Last reply
                      0
                      • M Marc Clifton

                        a = cx.ExecuteQuery("select top (1) a from foo where id={0}", id).First();
                        b = cx.ExecuteQuery("select top (1) b from foo where id={0}", id).First();
                        c = cx.ExecuteQuery("select top (1) c from foo where id={0}", id).First();

                        ... and about 20 more of those, yes, each effectively querying a scalar from foo with the same qualifier. Major redaction in the above, but you get the idea. So many things wrong about this. And people here wonder why the performance of nightly jobs is so bad. :((

                        Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                        P Offline
                        P Offline
                        paulcookie
                        wrote on last edited by
                        #16

                        I've come across worse. We had a programmer once that did a

                        select * from table

                        and then looped through the results until he found what he was looking for. Funnily enough, performance was OK on his test database, not so good on a production customer database.

                        1 Reply Last reply
                        0
                        • M Marc Clifton

                          a = cx.ExecuteQuery("select top (1) a from foo where id={0}", id).First();
                          b = cx.ExecuteQuery("select top (1) b from foo where id={0}", id).First();
                          c = cx.ExecuteQuery("select top (1) c from foo where id={0}", id).First();

                          ... and about 20 more of those, yes, each effectively querying a scalar from foo with the same qualifier. Major redaction in the above, but you get the idea. So many things wrong about this. And people here wonder why the performance of nightly jobs is so bad. :((

                          Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                          T Offline
                          T Offline
                          Tomaz Stih 0
                          wrote on last edited by
                          #17

                          I think this is the guy you're looking for.

                          M 1 Reply Last reply
                          0
                          • C charlieg

                            Marc/others - be gentle with me ;). This is what, C#? So someone seriously got carried away with cut and paste... Did I understand your rant correctly?

                            Charlie Gilley <italic>Stuck in a dysfunctional matrix from which I must escape... "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759

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

                            charlieg wrote:

                            with cut and paste.

                            Cut & paste would have been OK. This was copy and paste!

                            Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                            1 Reply Last reply
                            0
                            • B Bernhard Hiller

                              No no no! Do not change that, you'll break it! Don't you see that the other fields in that row of the table might change between queries? There's no transaction around these queries after all! And also the id parameter might change between queries, if a different process has write access to it. Oh, another thing: are you sure that the id column of the table is unique? So many things could go wrong with your refactoring. Better don't do that! You cannot find out what the original developer thought when he wrote that code thanks to a lack of proper documentation. :-D

                              Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!

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

                              Bernhard Hiller wrote:

                              You cannot find out what the original developer thought

                              You're making a big assumption there! ;)

                              Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                              1 Reply Last reply
                              0
                              • T Tomaz Stih 0

                                I think this is the guy you're looking for.

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

                                Tomaž Štih wrote:

                                I think this is the guy you're looking for.

                                Tools don't create bad code, it's the person wielding the tool!

                                Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                                T 1 Reply Last reply
                                0
                                • M Marc Clifton

                                  a = cx.ExecuteQuery("select top (1) a from foo where id={0}", id).First();
                                  b = cx.ExecuteQuery("select top (1) b from foo where id={0}", id).First();
                                  c = cx.ExecuteQuery("select top (1) c from foo where id={0}", id).First();

                                  ... and about 20 more of those, yes, each effectively querying a scalar from foo with the same qualifier. Major redaction in the above, but you get the idea. So many things wrong about this. And people here wonder why the performance of nightly jobs is so bad. :((

                                  Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                                  E Offline
                                  E Offline
                                  englebart
                                  wrote on last edited by
                                  #21

                                  Maybe it started as 20 separate tables each with a single column? DBA came along and joined the tables together, so the devs did the obvious refactor?

                                  1 Reply Last reply
                                  0
                                  • M Marc Clifton

                                    a = cx.ExecuteQuery("select top (1) a from foo where id={0}", id).First();
                                    b = cx.ExecuteQuery("select top (1) b from foo where id={0}", id).First();
                                    c = cx.ExecuteQuery("select top (1) c from foo where id={0}", id).First();

                                    ... and about 20 more of those, yes, each effectively querying a scalar from foo with the same qualifier. Major redaction in the above, but you get the idea. So many things wrong about this. And people here wonder why the performance of nightly jobs is so bad. :((

                                    Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                                    A Offline
                                    A Offline
                                    agolddog
                                    wrote on last edited by
                                    #22

                                    When you refactor, make sure to return the collection as a DataRow so that annoying strong-typing gets eliminated. ;)

                                    1 Reply Last reply
                                    0
                                    • M Marc Clifton

                                      Tomaž Štih wrote:

                                      I think this is the guy you're looking for.

                                      Tools don't create bad code, it's the person wielding the tool!

                                      Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                                      T Offline
                                      T Offline
                                      Tomaz Stih 0
                                      wrote on last edited by
                                      #23

                                      That's what I always say about guns. :cool:

                                      1 Reply Last reply
                                      0
                                      • M Marc Clifton

                                        a = cx.ExecuteQuery("select top (1) a from foo where id={0}", id).First();
                                        b = cx.ExecuteQuery("select top (1) b from foo where id={0}", id).First();
                                        c = cx.ExecuteQuery("select top (1) c from foo where id={0}", id).First();

                                        ... and about 20 more of those, yes, each effectively querying a scalar from foo with the same qualifier. Major redaction in the above, but you get the idea. So many things wrong about this. And people here wonder why the performance of nightly jobs is so bad. :((

                                        Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                                        K Offline
                                        K Offline
                                        KBZX5000
                                        wrote on last edited by
                                        #24

                                        This is were the Warhammer 40K universe gets it right, I think. They lobotomize and reeducate people like that. Clean, cost effective, ecological. I've pitched a similar idea, but marketing disagrees every time I propose to stab people. The numbers check out though; the reduction in technical debt and project costs is significant, even if you reallocate resource to pay for the funerals.

                                        1 Reply Last reply
                                        0
                                        • M Marc Clifton

                                          a = cx.ExecuteQuery("select top (1) a from foo where id={0}", id).First();
                                          b = cx.ExecuteQuery("select top (1) b from foo where id={0}", id).First();
                                          c = cx.ExecuteQuery("select top (1) c from foo where id={0}", id).First();

                                          ... and about 20 more of those, yes, each effectively querying a scalar from foo with the same qualifier. Major redaction in the above, but you get the idea. So many things wrong about this. And people here wonder why the performance of nightly jobs is so bad. :((

                                          Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                                          I Offline
                                          I Offline
                                          irneb
                                          wrote on last edited by
                                          #25

                                          Only the two options? To kill or not to kill? Nah! I want a bit of torture first! You know, just to get my mental stability back before they die!

                                          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