[Pljava-dev] advice needed

Thomas Hallgren thhal at mailblocks.com
Thu Feb 17 01:51:07 UTC 2005


George,
Lot of words. It all boils down to two things:
1. Creating a ResultSet in memory is often unacceptable.
2. Not all sets are the result of a query towards the database.

There's no point in discussing the likelyhood of this versus that. I'm 
trying to explain to you why the current design makes perfect sense but 
I don't seem to communicate that very well. I suggest you think of the 
following scenarios, perhaps that will make you realize what all of this 
is good for.

1. A big mainframe system has a Java API that allows you to query 
certain information. The system uses Java serialization to stream the 
result back to you through an ObjectInputStream. The objects that you 
read follow Java beans standard with getters for each column. Millions 
of rows might be returned as the result of a query. You want a function 
that returns a SETOF a type that corresponds to the Java beans. What do 
you do?

2. You have several very large XML documents on disk. The documents 
contain millions of elements of a certain type. You have a streaming SAX 
parser that can parse the documents, one element at a time. You want a 
function that returns elements from such a document as a SETOF a type 
that matches the type of the element. Reading all of the document into 
memory is not an option. How do you solve this?

3. You need a type where some columns match columns in an existing table 
but two or more columns are computed using some advanced algorithm that 
you've implemented in Java. The database table contains millions of 
records. You want a function that returns a SETOF this type. How would 
you create such a function?

Regards,
Thomas Hallgren





More information about the Pljava-dev mailing list