Print Thread
Page 1 of 4 1 2 3 4
String fileds vs Memory usage
#5707 11/27/03 07:50 PM
Joined: Nov 2003
Posts: 18
D
Member
OP Offline
Member
D
Joined: Nov 2003
Posts: 18
Hello,

Why DOA in TOracleDataSet allocates full memory for string fields?

For example I declare two TStringFields: NAME with size 100 and DESCRIPTION with size 200; all records in DataSet uses all memory for these fields (it doesn't matter how many characters these fields contain for each record).
So when I declare these fields 100/200 long, DataSet uses (it's example) 3068KB, but with sizes 50/100 it uses "only" 1644KB. Even if all records have empty strings in these fields.

Is there any reason that DOA does not support dynamic memory allocation for strings? When value in record for string field with Size=100 has 15 characters, then it should using memory for 15 characters, not for all 100 chars.

Best regards,
Daniel Stoch

Re: String fileds vs Memory usage
#5708 11/28/03 09:06 PM
Joined: Aug 1999
Posts: 22,208
Member
Offline
Member
Joined: Aug 1999
Posts: 22,208
I believe this is the nature of the TDataSet and TField classes. It is all based on fixed size buffers.


Marco Kalter
Allround Automations
Re: String fileds vs Memory usage
#5709 12/01/03 02:23 PM
Joined: Nov 2003
Posts: 18
D
Member
OP Offline
Member
D
Joined: Nov 2003
Posts: 18
Sorry but I don't agree with you. It is possible to use dynamic size buffers with TDataSet and TField classes. What does it mean "I believe"? Probably you are not sure. It is very strange for me: you write such components as DOA and you are not sure how does VCL classes are implemented and how to implement dynamic size buffers?!!!

Sorry for this example, but ODAC components from CoreLab uses dynamic size buffers, so as you can see it is possible. Your DOA components are very good, but dynamic size buffer can make them much better smile .

Re: String fileds vs Memory usage
#5710 12/16/03 02:22 PM
Joined: Nov 2003
Posts: 18
D
Member
OP Offline
Member
D
Joined: Nov 2003
Posts: 18
Hello,

Could someone reply to my previous post? Or maybe you are implementing "dynamic" string buffers now? wink

Best regards
Daniel Stoch

Re: String fileds vs Memory usage
#5711 12/16/03 11:12 PM
Joined: Aug 1999
Posts: 22,208
Member
Offline
Member
Joined: Aug 1999
Posts: 22,208
I looked into this, and it is indeed possible to implement a feature to compress the dataset result set storage. The record buffer needs to comply to TDataSet/TField rules, but one can store the entire result set as one sees fit. Maybe we can add this in a future release.


Marco Kalter
Allround Automations
Re: String fileds vs Memory usage
#5712 12/17/03 05:06 AM
Joined: Oct 1999
Posts: 138
Eschborn, Germany
Member
Offline
Member
Joined: Oct 1999
Posts: 138
Eschborn, Germany
Hi Macro,

is it possible to say more then maybe?

I think this is a very very helpfull feature for people working with large datasets and large varchar fields, so i would realy appreciate if we can see a 4.1 in January or February 2004 with this feature wink

Greetings
Jens

Re: String fileds vs Memory usage
#5713 12/17/03 11:05 PM
Joined: Aug 1999
Posts: 22,208
Member
Offline
Member
Joined: Aug 1999
Posts: 22,208
For read-only datasets this is relatively simple to implement. For updateable datasets we have to rewrite a large part of the memory management. We have to look into this before I can say anything more specific than "maybe".


Marco Kalter
Allround Automations
Re: String fileds vs Memory usage
#5714 12/18/03 05:25 AM
Joined: Nov 2003
Posts: 18
D
Member
OP Offline
Member
D
Joined: Nov 2003
Posts: 18
Hi,

Thanks for your answer Marco and thank you Jens for joining this topic. I think it would be great if you will be able to implement this feature. In our application we process huge amount of data, so effective memory management is a very important for us.

Good luck,
Daniel

Re: String fileds vs Memory usage
#5715 12/18/03 01:58 PM
Joined: Nov 2003
Posts: 89
Germany
A
al0 Offline
Member
Offline
Member
A
Joined: Nov 2003
Posts: 89
Germany
[quote]Originally posted by Daniel Stoch:
Hi,

In our application we process huge amount of data, so effective memory management is a very important for us.

[/quote]I dont't want to meddle with your discussion, but cost of intensive memory allocation/deallocation for dynamic buffer managment may (or may not) heavily overweight benwefits from memory saving.

Yours,

Oleksandr

Re: String fileds vs Memory usage
#5716 12/18/03 02:41 PM
Joined: Oct 1999
Posts: 138
Eschborn, Germany
Member
Offline
Member
Joined: Oct 1999
Posts: 138
Eschborn, Germany
You may be right.

Because of this reason it should be an optional parameter.

Greetings
Jens Fudickar

Re: String fileds vs Memory usage
#5717 12/18/03 05:37 PM
Joined: Nov 2003
Posts: 18
D
Member
OP Offline
Member
D
Joined: Nov 2003
Posts: 18
[quote]Originally posted by al0:
I dont't want to meddle with your discussion, but cost of intensive memory allocation/deallocation for dynamic buffer managment may (or may not) heavily overweight benwefits from memory saving.

Yours,

Oleksandr
[/quote]Hi,

It depends on situation. For example when you only browsing data (and cache data on client application) from many SQL queries, I think the cost should not be such big. Another thing is that now computers are quite fast (CPU and memory), so cost of dynamic alloc/dealloc should not overweight benwefits from memory saving (IMHO wink ).

And as Jens said it should be an optional parameter (both for read-only and modifiable TOracleDataSet).

Best regards,
Daniel

Re: String fileds vs Memory usage
#5718 12/19/03 06:23 PM
Joined: Nov 2003
Posts: 89
Germany
A
al0 Offline
Member
Offline
Member
A
Joined: Nov 2003
Posts: 89
Germany
[quote]Originally posted by Daniel Stoch:

It depends on situation. Another thing is that now computers are quite fast (CPU and memory), so cost of dynamic alloc/dealloc should not overweight benwefits from memory saving (IMHO wink ).

And as Jens said it should be an optional parameter (both for read-only and modifiable TOracleDataSet).
[/quote]Definitely, it depends, so I have written "it
may (or may not)
overweight ...".

Really, memory allocation maintaince is quite time-consumming process (especially if you have a lot of memory chunks) and borland memory manager is not the best (while it is not hte worst as well). And all this stuff are intended to really large sets we (I guess) million of records. So performance degradation may be noticable. BTW, if datasets are really big it is not very wise to fetch the whole dataset to the client. And I can't even imagine browsing of such amount of data. Reporting? May be, but who need a report with handred thousand rows? And filtering (normally) has to be performed on server. So I'm not sure that any programm really need this dynamic memory management for dataset (IMHO much more likely that program that claim the need in this feateru has serious design flaw).

Yours,

Oleksandr

Re: String fileds vs Memory usage
#5719 12/19/03 06:28 PM
Joined: Oct 1999
Posts: 138
Eschborn, Germany
Member
Offline
Member
Joined: Oct 1999
Posts: 138
Eschborn, Germany
I'm not sure, that you are completly right.

For example. A table has 20 Varchar2-Fields with Length 4000. This means 80000 Bytes for one record.
1000 Records means 80.000.000 Bytes.
And i think 1000 Records is not so much.
We have sometimes tables with some very large fields, which are mostly completly empty.
In such cases there is a lot memory to save which is not used.

Greetings
Jens

Re: String fileds vs Memory usage
#5720 12/22/03 01:20 AM
Joined: Nov 2003
Posts: 89
Germany
A
al0 Offline
Member
Offline
Member
A
Joined: Nov 2003
Posts: 89
Germany
[quote]Originally posted by Jens Fudickar:
I'm not sure, that you are completly right.

For example. A table has 20 Varchar2-Fields with Length 4000. This means 80000 Bytes for one record.
1000 Records means 80.000.000 Bytes.
And i think 1000 Records is not so much.
We have sometimes tables with some very large fields, which are mostly completly empty.
In such cases there is a lot memory to save which is not used.

Greetings
Jens
[/quote]Possibly, but for such structure I would consider CLOB instead of varchar2. And fetch them on client only on request.

Yours,

Oleksandr

Re: String fileds vs Memory usage
#5721 12/22/03 03:19 PM
Joined: Oct 1999
Posts: 138
Eschborn, Germany
Member
Offline
Member
Joined: Oct 1999
Posts: 138
Eschborn, Germany
You are principle right with using clobs. But there are some disadvantages of clobs.

And there are old database structures using varchar2. So it's not allways possible. :-)

Greetings
Jens

Re: String fileds vs Memory usage
#5722 12/22/03 05:53 PM
Joined: Nov 2003
Posts: 18
D
Member
OP Offline
Member
D
Joined: Nov 2003
Posts: 18
[quote]Originally posted by Jens Fudickar:
I'm not sure, that you are completly right.

For example. A table has 20 Varchar2-Fields with Length 4000. This means 80000 Bytes for one record.
1000 Records means 80.000.000 Bytes.
And i think 1000 Records is not so much.
We have sometimes tables with some very large fields, which are mostly completly empty.
In such cases there is a lot memory to save which is not used.

Greetings
Jens
[/quote]Exactly, this a good example.

Another one: we browse in our application data from many diffrent selects. And all results are cached on client (for reducing unneeded quering of DB). Then if these selects contain data from Varchar2 fields, application can very fast eat 100MB of system memory. And it is not necessary to fetch 1000000 records, 100-1000 per one select is enough to allocate all of system memory.

And I don't agree with you Oleksandr that "IMHO much more likely that program that claim the need in this feateru has serious design flaw).". There are some specific situations when it is necessary.

Re: String fileds vs Memory usage
#5723 12/22/03 08:00 PM
Joined: Nov 2003
Posts: 89
Germany
A
al0 Offline
Member
Offline
Member
A
Joined: Nov 2003
Posts: 89
Germany
[quote]Originally posted by Daniel Stoch:
And I don't agree with you Oleksandr that "IMHO much more likely that program that claim the need in this feateru has serious design flaw).". There are some specific situations when it is necessary. [/QB][/quote]You are right that specific situation may exist. But it still more likely that program has design flaw then that situtation is really so specific.
In opposite case situation will be not specific but quite common wink

Re: String fileds vs Memory usage
#5724 05/27/04 02:51 AM
Joined: Oct 1999
Posts: 138
Eschborn, Germany
Member
Offline
Member
Joined: Oct 1999
Posts: 138
Eschborn, Germany
Marco,

did you have any new informations on this issue?

Is it possible to realize this only for the readonly datasets? This can be a lot of help for some parts!!

Greetings
Jens

Re: String fileds vs Memory usage
#5725 05/27/04 07:44 PM
Joined: Aug 1999
Posts: 22,208
Member
Offline
Member
Joined: Aug 1999
Posts: 22,208
It's on the list of enhancement requests, but I don't have a concrete date.


Marco Kalter
Allround Automations
Re: String fileds vs Memory usage
#5726 05/28/04 12:10 PM
Joined: Oct 2003
Posts: 9
J
Member
Offline
Member
J
Joined: Oct 2003
Posts: 9
Maybe you can publish a list with requested enhancements on this site. cool

This list would contain the requested enhancements and an indication when/if it will be implemented. (or something like that)

Greetings Johan Visser

Re: String fileds vs Memory usage
#5727 05/28/04 09:55 PM
Joined: Oct 1999
Posts: 138
Eschborn, Germany
Member
Offline
Member
Joined: Oct 1999
Posts: 138
Eschborn, Germany
Hi Marco,

i think this is a realy good idea.

Greetings
Jens

Re: String fileds vs Memory usage
#5728 05/29/04 07:41 PM
Joined: Oct 1999
Posts: 138
Eschborn, Germany
Member
Offline
Member
Joined: Oct 1999
Posts: 138
Eschborn, Germany
Hi Marco,

Maybe you can ask your customers which of the features they want to see next .

Greetings
Jens

P.S. For me the memory problem is realy important :-)

Re: String fileds vs Memory usage
#5729 06/01/04 04:03 PM
Joined: Jun 2004
Posts: 16
H
Member
Offline
Member
H
Joined: Jun 2004
Posts: 16
Jens, couldn't you use TOracleQuery (which, I believe, needs less memory) and copy the results into a memory table which supports compression, like TkbmMemTable?

As you're talking about read-only datasets, I thought that this could be an option for you...

Re: String fileds vs Memory usage
#5730 06/01/04 04:47 PM
Joined: Oct 1999
Posts: 138
Eschborn, Germany
Member
Offline
Member
Joined: Oct 1999
Posts: 138
Eschborn, Germany
Holger,

that's not possible. The overhead is too big.

For example. With a dataset there is no effort to load only 1000 records and on demand the next 1000. Doing this tOracleQuery and MemDatasets you got a lot of work.

Greetings
Jens

Re: String fileds vs Memory usage
#5731 06/01/04 06:26 PM
Joined: Nov 2003
Posts: 18
D
Member
OP Offline
Member
D
Joined: Nov 2003
Posts: 18
Hi,

Copying the results into a memory table takes some time. Holger, your solution for me sound like: "why don't you create a new TDataSet descendant class, inherited form TkbmMemTable, which will be using TOracleQuery for fetching records" smile . It looks like a new implementation of TOracleDataSet! I know it is possible, we have in our application cached DataSets based on TkbmMemTable (which use TOracleQuery) for querying lookups' values, but they don't give us all functionality TOracleDataSets do (eg. QBE).

But to modify records, we can first copy them into memory table (eg. TkbmMemTable). But for browsing only, it takes to much time (for implemementing this too). So dynamic size buffers for read-only TOracleDataSet could be a great feature wink .

Best regards,
Daniel

Re: String fileds vs Memory usage
#5732 06/01/04 08:24 PM
Joined: Oct 1999
Posts: 138
Eschborn, Germany
Member
Offline
Member
Joined: Oct 1999
Posts: 138
Eschborn, Germany
Yep!!! :-)

Greetings
Jens

Re: String fileds vs Memory usage
#5733 01/25/05 04:15 PM
Joined: Nov 2003
Posts: 18
D
Member
OP Offline
Member
D
Joined: Nov 2003
Posts: 18
Hi,

Is there any chance for implementing this functionality, described in this thread over one year ago?
Or is it, like people says in my country, "the dream of cut head"? smile

Best regards,
Daniel Stoch

Re: String fileds vs Memory usage
#5734 01/25/05 11:03 PM
Joined: Aug 1999
Posts: 22,208
Member
Offline
Member
Joined: Aug 1999
Posts: 22,208
This turned out to be a little bit more work than expected, but it is still on our to-do list. Maybe we can add this in 4.1.


Marco Kalter
Allround Automations
Re: String fileds vs Memory usage
#5735 01/27/05 04:09 PM
Joined: Oct 1999
Posts: 138
Eschborn, Germany
Member
Offline
Member
Joined: Oct 1999
Posts: 138
Eschborn, Germany
4.1 ??

Any timeframe, list of planed changes or so ?

Greetings
Jens

Re: String fileds vs Memory usage
#5736 01/27/05 08:35 PM
Joined: Aug 1999
Posts: 22,208
Member
Offline
Member
Joined: Aug 1999
Posts: 22,208
Not yet.


Marco Kalter
Allround Automations
Re: String fileds vs Memory usage
#5737 02/10/07 03:58 PM
Joined: Aug 2004
Posts: 83
Ukraine
A
Member
Offline
Member
A
Joined: Aug 2004
Posts: 83
Ukraine
Marco,
did you have any new informations on this issue?
-----------------
Desc for any field, based on User string Function, return size 4000:
select myStringFunction() as test from dual:
desc: test VARCHAR (4000)
-----------------------
Greetings

Re: String fileds vs Memory usage
#5738 02/12/07 09:40 PM
Joined: Aug 1999
Posts: 22,208
Member
Offline
Member
Joined: Aug 1999
Posts: 22,208
This did not make it into 4.1, which focuses on Unicode support. We'll look into this for a 4.1 patch release.


Marco Kalter
Allround Automations
Re: String fileds vs Memory usage
#5739 07/02/08 12:09 PM
Joined: Aug 2004
Posts: 83
Ukraine
A
Member
Offline
Member
A
Joined: Aug 2004
Posts: 83
Ukraine
up

Re: String fileds vs Memory usage
Joined: Aug 2003
Posts: 19
Moscow, Russia
N
Member
Offline
Member
N
Joined: Aug 2003
Posts: 19
Moscow, Russia
Is it still in TODO?
It's really memory-eating behavior, and because it in our selects all string functions surrounded with substr(function(), 1, 255). But it's not good solution, more good solution is to make strings in TOracleDataset dinamically-allocated. We waiting it!

Page 1 of 4 1 2 3 4

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.276s Queries: 14 (0.087s) Memory: 2.6768 MB (Peak: 3.0924 MB) Data Comp: Off Server Time: 2024-05-06 08:19:14 UTC
Valid HTML 5 and Valid CSS