473,414 Members | 1,627 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

How to load a TABLE fuilly in memory and keep it

Hi all...

I have a table that will never change. Specifically it's a mortality chart
that I need to use to make some calculations. One column of the table is the
age of the person, and other column is the factor to apply to the
calculation.

Suppose the calculation need to be made for 5000 people. It's inadmissible
to make 5000 SELECT's to get the factor for each person. That calculation
isn't done for only one group of persons, but for a lot of groups. So the
solution is to place all that data in memory, in ascending order, so that
the age will be the index to that memory table and the factor will be the
data stored in that memory location.

I want to be able to do something like this

VALUE := 0;
FOR I IN 1..NUM_PERSON LOOP
VALUE := VALUE + TABLE_IN_MEMORY( AGE( I ) ) * SOME_OTHER_NUMBER;
END LOOP;
Is it clear what the problem is? Any help will be greatly appreciated

Thanks a lot in advance
Jaime


Jul 19 '05 #1
1 11331
don't think in terms of 3GL programming....

if you need to make the calculation for 1 or 5,000 different rows, simply
join in the correct row from your mortality table, ie:

select p.name, p.age, p.age * m.factor
from
person p
, mortality_chart m
where
p.something = <some criteria>
and
p.age = m.age

likely you'll index the AGE column in your mortality_chart table

let Oracle handle the caching of data from the lookup table -- that's its
job
on the other hand, if you really, need an in-memory structure for your
mortality table, you can populate a PL/SQL collection with the values --
either from a table or just coded in your PL/SQL package -- and use the age
as an index

give some more details on how you're processing your 5,000 mortals

-- mcs

"Jaime Stuardo" <js******@softhome.net> wrote in message
news:3f********@nova.entelchile.net...
| Hi all...
|
| I have a table that will never change. Specifically it's a mortality chart
| that I need to use to make some calculations. One column of the table is
the
| age of the person, and other column is the factor to apply to the
| calculation.
|
| Suppose the calculation need to be made for 5000 people. It's inadmissible
| to make 5000 SELECT's to get the factor for each person. That calculation
| isn't done for only one group of persons, but for a lot of groups. So the
| solution is to place all that data in memory, in ascending order, so that
| the age will be the index to that memory table and the factor will be the
| data stored in that memory location.
|
| I want to be able to do something like this
|
| VALUE := 0;
| FOR I IN 1..NUM_PERSON LOOP
| VALUE := VALUE + TABLE_IN_MEMORY( AGE( I ) ) * SOME_OTHER_NUMBER;
| END LOOP;
|
|
| Is it clear what the problem is? Any help will be greatly appreciated
|
| Thanks a lot in advance
| Jaime
|
|
|
|
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David Frankel | last post by:
I have created an MDC table using UDB ESE v8.1 fixpack 6 on AIX 5.1. The table is organized by 3 columns with a product of 100 * 3 * 5 values -- only 1500 values. When I try to use the load utility...
0
by: Peter | last post by:
When I issue call sqlj.install_jar('file:///f:/jars/mail.jar','MAIL'); I get the messages SQL4301N Java or .NET interpreter startup or communication failed, reason
6
by: Just D. | last post by:
Hi All, I have a question. I need to load some EXE file into memory and then find a way how to run it from the memory without saving to disk. I know that it was possible in C++ to execute any...
1
by: D | last post by:
Say you have three tables apples, oranges and bananas and each table has a different amount of fields that are obviously particular to that type of fruit. Now I want to load them into a form based...
19
by: Alex Madon | last post by:
Hello, I am testing a web application (using the DBX PHP function to call a Postgresql backend). I have 375Mb RAM on my test home box. I ran ab (apache benchmark) to test the behaviour of the...
17
by: John A Grandy | last post by:
For a Hashtable that is expected to contain no more than 100 DictionaryEntry elements , what is the best load factor ? ( This Hashtable is a encapsulted in a class , an instance of which is...
2
by: contractsup | last post by:
Environment: $ uname -a AIX <withheld2 5 000100614C00 $ db2level DB21085I Instance "<withheld>" uses "32" bits and DB2 code release "SQL08024" with level identifier "03050106"....
4
by: Chris Nethery | last post by:
Hello everyone, I have a challenging issue I need to overcome and was hoping I might gain some insights from this group. I am trying to speed up the process I am using, which is as follows: ...
3
by: Sunny | last post by:
Hi, Can someone tell me, How to load the Body Html from a text file that contains javascript. to Manage my files I am creating an Index Page. <html> <head> <meta http-equiv="content-type"...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.