struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From NetSQL <maill...@friendVU.com>
Subject Re: Struts DB Access :: Best Practices
Date Thu, 10 Mar 2005 19:48:16 GMT
Scott Lamb wrote:
> NetSQL wrote:
> 
(RowSet is realy a ArrayList of
>> HashMaps. Rows of Columns)
> 
> 
> What does a ArrayList of HashMaps get you over a java.sql.ResultSet? 


Collections are lighter and easier to SoA.


>> I look at it like this:
>> -SQL is a Set oriented lang.(row by row processing is exponentialy 
>> slower)
> 
> 
> This is totally wrong


Maybe you think that. I think I am right.


> 
> - Putting all the data into another container _is_ row-by-row 
> processing. You're always doing row-by-row processing, even just to 
> fetch it from the database server. 


Maybe you think that. JDBC drivers do not stream rows; it sends it after 
"Select" processing, joins, ordering, etc has been done. So if you do 
order by, and your table has millions of rows, 1st the SQL engine sorts 
and then it starts sending.... the millions of rows. DBCacnel... just 
stops the stream.

Ex#2: you can create a cursor to give everyone in NYC a raise, and go by 
  row by row. Or you can do a set operation in one command. I allways 
avoid row by row, and allways try to go for set, as per direction by 
Celko and others. Your millage may vary.

When I need to display chunks of data I do limit/offset SQL side, not 
Java side. In Java, I let iBatis cache it for me w/o any code on my part.

hth,

.V




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message