Array Element by Agonizing Array Element

  • Comments posted to this topic are about the item Array Element by Agonizing Array Element

    Best wishes,
    Phil Factor

  • Phil, the link in your first paragraph isn't working.  It's pointed at some "C:" drive file somewhere.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • PowerShell is useful in many, but darn, it's slow for munging/examining large amounts of raw data. We end up using it in troubleshooting situations on client's Windows servers where there are no other tools immediately available.(Without going through 17 layers of approval and red tape...) Fortunately most Linux servers all have Python and/or Perl), which are born to slice and dice raw data. Eventually we will have some .NET libraries as part of the standard load that will be callable from PowerShell that will speed any ad-hoc-ery needed.

    Besides CLI environments, functional languages (like F#) and such have the concept of the pipeline (instead of nested functions) as an essential core of the language.

  • Phil Factor - Tuesday, May 16, 2017 9:14 PM

    Comments posted to this topic are about the item Array Element by Agonizing Array Element

    Having spent the last few weeks finally grasping FP with F# and F# interactive, I'm starting to use it in place of POsh and C#.  Often the resulting programs are smaller, faster and easier to read and write (once you get past the initial learning curve).  Though once skeptical, I now agree with the observation that if you can get it to compile, it will probably do  what you want.  Kudos to the amazing type inference system.

    Oh, and piping is a natural part of the language!

  • How fast loop is depends on what it doing in between for each iteration. If it's executing 10,000 calls to a SQL Server stored procedure for each loop, then your choice of programming language, whether it be interpreted or compiled, is irrelevant. You will sit waiting for a long time, and while you perhaps take the opportunity to fetch a cup of coffee or browse the Daily Onion.com, the DBA team will be scrambling to figure who or what is launching a denial of service attack against the database.

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • Yeah, I normally just stick to Python for most looping simply because it's easier to partition out the tasks across multiple machines before it even gets to SQL Server. If you're dealing with larger datasets, it becomes a fast (in terms of development and processing) and easy approach to solving a problem without getting into other high level languages that can be a bit of pain to fully implement.

    Really can't beat the ease of.


    for line in data:
        do_something(line)

    to get you started.

  • xsevensinzx - Friday, May 19, 2017 6:58 AM

    Yeah, I normally just stick to Python for most looping simply because it's easier to partition out the tasks across multiple machines before it even gets to SQL Server. If you're dealing with larger datasets, it becomes a fast (in terms of development and processing) and easy approach to solving a problem without getting into other high level languages that can be a bit of pain to fully implement.

    Really can't beat the ease of.


    for line in data:
        do_something(line)

    to get you started.

    The pseudo-code for my favorite type of loop (pseudo-cursor) is ...


     SELECT SomeColumns
       FROM dbo.SomeTable
      WHERE SomeColumns meet SomeCriteria
    ;

    😉

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply