1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

MySQL Stored Procedure/Cursor Isn't Going Through Entire Table :(

Discussion in 'MySQL' started by 2blind2c#, Mar 24, 2008.

  1. #1
    Well I have a site that I run and made a testing version on home pc via xampp. Also made a nice nifty stored procedure which makes a table that shows all the duplicate entries, however while it executes through all the table records (over 30,000) on production server, it'll barely get through afew hundred on home tester as it seems to finish early (everytime it's around 2 minutes and 20-30 seconds).

    So right now I'm stumped on why tester MySQL is acting like crap with this mysql/cursor SP & finishing execution after 2+ minutes everytime. No error message to even tell me that something is going haywire since running it in command line gives me "Query OK, 0 rows affected (2 min 25.95 sec)" which would suggest that everything is peaches n cream (of course it isn't since it isn't even getting through 1% of the database) when it isn't. Any help please would be greatly appreciated :(
     
    2blind2c#, Mar 24, 2008 IP
  2. amnezia

    amnezia Peon

    Messages:
    990
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Im not sure why you would want to use a cursor to find duplicate results, you can do this with pure SQL much quicker
     
    amnezia, Mar 25, 2008 IP
  3. 2blind2c#

    2blind2c# Peon

    Messages:
    147
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    lol... you know, funny you mention that because I had written stuff in MS SQL Server (2000) that had me avoid cursors... however in this instance I'm not sure how to convert that SP/User Function code to MySQL especially seeing how some of the stuff seemed like a hack in string manipulation that may only work within that SQL Server environment. Thus me trying to work on this cursor until I could figure out how to have same functionality coded out on MySQL...

    ...which of course brings me to this current problem of stored procedure not completing it's run & quitting after 2 minutes. :confused:

    Of course, with the cursor running for about 1 hour & 30+ minutes I'm also all ears if you also have any ideas on some of the bits of SQL Server code coverted into MySQL... just was saving that one for later since that's a seemingly different issue that I was gonna ask you good folks in another thread :D
     
    2blind2c#, Mar 25, 2008 IP
  4. 2blind2c#

    2blind2c# Peon

    Messages:
    147
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Soooo... nobody has a clue on why a stored procedure would end early? :(
     
    2blind2c#, Mar 29, 2008 IP
  5. 2blind2c#

    2blind2c# Peon

    Messages:
    147
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    meeeh, nevermind

    Like somone else hinted at, I found a way around stinkin cursors altogether ^_^.
    Just used the COUNT of my query and a loop to go through each row. Not that much faster, but it at least goes through all rows that I want it to go through while seemingly having a bit more control.

    Also helps that the table's ID's are ints that I could account for via incrementing counters
     
    2blind2c#, Apr 1, 2008 IP