SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Writable Cached Table


Writable Cached Table

Author
Message
Bkokster
Bkokster
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
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
Evil Kraig F
Evil Kraig F
SSCrazy Eights
SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)

Group: General Forum Members
Points: 8569 Visits: 7660
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
GilaMonster
GilaMonster
SSC Guru
SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)

Group: General Forum Members
Points: 86851 Visits: 45259
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


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search