7
LanguidDev
179d

So SQL Cursors definitely suck. Got a one time data migration script that needs to migrate 3 million rows of data (which I misread as 300k)

Using cursors it would take 15 hours to complete. Ive just had to make the most disgusting script using recursion and a whole lot of CTE's but it now takes about 15 mins to do the same faff

I feel dirty just reading the script, but atleast it'll be dead and buried once it's been ran

TLDR Cursors bad, m'kay

Comments
  • 6
    Do you understand what cursors are...

    And would be nice to get the specific RDBMs.

    If we are talking about the same thing, you are comparing apples to broccoli.

    Might sound harsh, but reading the rant I got an heart attack because that sounds like the worst kind of idea to use cursors for.... *sad face*
  • 0
    Cursors are the most common pitfall for new SQL programmers who do not understand their purpose or how heavy they are. Young ones think they are a good way to do operations at the row level and then they are burned when their simple query takes half an hour to complete.

    I mostly use cursors for one-way pagination from my database these days.
Add Comment