Writable Cached Table

  • Hi,

    I am trying to build multiple neural networks in sql. I'm doing this by looping through rows in a table using a cursor ( which I know most sql gurus hate, but this isn't where I'm getting stuck) and based on on a calculation for each row I update the values which make up my neural network which I store in another table. Doing it this way takes way too long so I stored my neural network's values as variables and this works well since the values that must be updated are stored in memory. However, I aim to make this a scalable solution so that a multitude of of neural nets can be developed which would require multiple variable declarations. Being able to store these values in a cached table would work well. I know ssis allows one to cache tables but then they're read only lookup tables, is there any way to cache a table so that it's updatable? Is this maybe possible in SQL through SQL server analysis services?

    Thanks in advance

  • Bkokster (10/20/2012)


    Doing it this way takes way too long

    Well, if it's too long, the cursor is probably where you are getting stuck, you may just be unfamiliar with a few tricks we might use to speed it up, so even though it loops you'd get more done per pass. If you can post the schema/sample data/code/.sqlplan, we can help you work with that. However...

    so I stored my neural network's values as variables and this works well since the values that must be updated are stored in memory.

    To clarify, did you store the values as variables, or as a Table Variable? A table variable can write to disk just like a temp table can.

    I know ssis allows one to cache tables but then they're read only lookup tables, is there any way to cache a table so that it's updatable?

    The only cache'd tables I'm familiar with in SSIS are either Object Recordsets or RAW files. The Object Recordsets can be manipulated in script components as updateable, but you'd need to be familiar with the structure of them. RAWs are written in stone. You'd have to re-write the RAW to change it. If it's neither of these, can you drop the BOL page for what you're using here? I may just be mind-blanking on it.

    Is this maybe possible in SQL through SQL server analysis services?

    SSAS isn't going to go where you want here either. All a cube really does is pre-aggregate data prior to slice and dice while giving you a convienient way to reorganize the data in all sorts of different pivots. It doesn't do any heavy logic or recursion. Well, not without boatloads of MDX coding that I personally wouldn't even attempt, that's not really what it's there for.

    So, really, this comes back to the first part of the issue. You're running what you're already aware is probably a non-optimal script and the time it's taking is far too long. I'd start there. If you're not sure of what-all we'd need to be able to assist you with the least amount of clarifications and double checks, read through the link in my signature for index/tuning assistance. We'll need most of that anyway before we can help you without guessing too much to fill in the blanks.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Just a general point... SQL Server and AI generally don't go together. Oh, it's possible, I've written a GA framework in SQL, but it's not usually efficient. Maybe consider sticking to something like C#, C++, F# or similar.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 3 posts - 1 through 2 (of 2 total)

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