473,473 Members | 1,962 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Application Server on top of SQL Server

5 New Member
Hi,

I'm new to programming in .Net so maybe this is a naive question.

The situation:

I am writing an application in C# .net which will be integrated into SQL server as an assembly and run in the form of managed code. Currently there is a function or 2 in my class and i can call this function using an sql command in the query analyzer. It takes as input 2 data tables, then reads them, and then returns a bunch of values in the form of a table ( IEnumerable ).

My problem is that the input table could be as large as 100 million lines and the idea is to eventually test the function on a table with 1 billion rows. Now how the function works is that it reads the first table, and creates a binary tree from it. Then it uses the second table row by row to query the binary tree. Then it returns the data for each row of the 2nd table.

the problem is that the second table at some point could be just a single row, ie it would be something a user could query one by one at whim. Now constructing the tree of 100 million rows takes a long time. So everytime the user sends a single row input query it would take a long time to return.

I was thinking if I could somehow make the data structure ( tree ) persistent in memory ( assuming the 1st table does not change ) so that 1 by 1 queries by the user do not have to build the tree again and again ( obv. 1 billon rows prolly wont fit in memroy but I can work out those details later ), but I need essentially an application server that can maintain the ( table, tree ) data for as long as possible in memory. Is this possible with managed code in SQL server.

Thanks alot in advance for even reading this.
Oct 18 '07 #1
3 935
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
Hi,
Re-constructing a binary tree will definitely take time...
The best approach would be to create an index file, so even if the system is booted, you dont have to reconstruct it.

Either create index files of your own, or you may write this object to a file and then pick it up back into memory when you want(this might take much lesser time than rebuilding)

I am not aware how this fits into sql server, but as long as you are using the .net framework you should be fine)

You can also write events to add/delete items from the binary tree whenever a row is added/deleted/edited

cheers
Oct 18 '07 #2
manyuaditya
5 New Member
Hey, thanks for the reply. As of now I am considering this:

Since the tree will be created from the source data in an array format, I can store this directly in an indexed table. ( 1st row is 1st element and so on ). So next time when I have to read the binary tree into memory, I can simply read the whole table row by row into memory.

This kind of makes sense. The tree should be able to fit in memory. Assuming that it does. My questions are:

1. Is there a way to read a table directly into an array ( and visa versa ), without having to iterate row by row. ( I think row by row will be too slow ) and since its like a direct vertical to horizontal transformation. I would think this is a common scenario and there should be a solution to this other than SqlDataReader.Read().

2. If this option does not exist, then would reading the tree into an array from a flat file be faster as compared to the database?

3. From query to query is there a way not to read the tree into an array in memory again and again each time my managed code function is called. Can't i make the array persist somehow.

Thanks.
Oct 29 '07 #3
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
1. Is there a way to read a table directly into an array ( and visa versa ), without having to iterate row by row. ( I think row by row will be too slow ) and since its like a direct vertical to horizontal transformation. I would think this is a common scenario and there should be a solution to this other than SqlDataReader.Read().
That is what a database does usually, Stores it in a B+ tree type / similar structure (but they have their own logic to make it more efficient) So reading a database would almost mean making your own database. (not what you want to do) moreover when u get a dataset, it is already an array , so format your SQL so that your dataset contains what you want.

2. If this option does not exist, then would reading the tree into an array from a flat file be faster as compared to the database?
A database stores data in a very structured format...a B+ tree and even better. So compare a flat file with a database and think about it yourself (why would databases exists then)

3. From query to query is there a way not to read the tree into an array in memory again and again each time my managed code function is called. Can't i make the array persist somehow.
I am not sure of this one, but i have been partially successful at this (and then i left it long ago) , you can serilalize and object to be written to a file and then read it back again, so you dont have to reindex/ re-read everything

cheers and good luck
Oct 29 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

33
by: aa | last post by:
I am migrating to PHP from ASP where there are the Application Scope variables which are accessible from any page on a website and which are used, in particular, for hit counters. Is there a similar...
3
by: ^CeFoS^ | last post by:
Hi to everybody, due to I want to use the serial port of a server machine through an applet allocated in html document. > Then one application will run in the server machine and using > the serial...
5
by: Matt | last post by:
I think this is the basic concept in ASP server-side development. My boss told me web application is NOT client-server application. I argued with him because browser is the client, and the server...
3
by: Varkey | last post by:
Dear friends, I am new to .NET based app development and have a pretty elementary query, I suppose... I have caught up with the basics of .NET pretty well, thanks to some Microsoft VB/ASP...
43
by: Davey | last post by:
I am planning on developing an application which will involve skills that I have very little experience of - therefore I would appreciate comments on my initial design thoughts. Overview on...
9
by: Wayne Wengert | last post by:
I built an ASP application and it runs fine on my local IIS. I am trying to move the application to my web service (ISP) out on the internet. I've read several of the help articles but they all...
21
by: Chris | last post by:
I'm trying to get an existing VS.NET project up on my Win2003 server and I get the following error (on the actual website page): "It is an error to use a section registered as...
17
by: Timothy.Rybak | last post by:
Hello all, This is my first attempt at an application, so kid gloves are appreciated. I need to make a very simple form that only has a few elements. One is TraceCode - a text field that is...
13
by: Kevin Liebowicz | last post by:
Yes, I wasted the past two days trying to fix this. Yes, this is on a Win2003 Server. Yes, this machine is a domain controller. Yes, I seen the dozens of KB articles like this one:...
6
by: Tony Johansson | last post by:
Hello! We have a C#.ASP.NET application that runs on a IIS 6. The application contains actually several asp pages but there is no GUI. The application receive an xml file that is processed....
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.