Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Writable Cached Table Expand / Collapse
Author
Message
Posted Saturday, October 20, 2012 5:48 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, June 4, 2013 4:04 AM
Points: 1, Visits: 13
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
Post #1375100
Posted Monday, October 22, 2012 1:53 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 2:18 AM
Points: 6,258, Visits: 7,445
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 | Forum Netiquette
For index/tuning help, follow these directions. |Tally Tables

Twitter: @AnyWayDBA
Post #1375294
Posted Monday, October 22, 2012 2:11 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 10:19 AM
Points: 43,026, Visits: 36,192
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 2008, MVP
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

Post #1375295
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse