You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James Mitchell <jm...@telocity.com> on 2002/09/08 08:38:13 UTC

RE: [OT] RE: Struts and Large ResultSet

Sorry for getting in late on this one.

"I was just at Google, and Google's an all-MySQL shop. Why did they do it?
Because they looked at DB2 and it was expensive and it didn't offer any
added value."  - Jonathan Schwartz

 Here's the full story:
 http://news.com.com/2008-1082-947510.html



James Mitchell
Software Engineer\Struts Evangelist
Struts-Atlanta, the "Open Minded Developer Network"
http://www.open-tools.org/struts-atlanta



> From: Bartley, Chris P
> Subject: RE: [OT] RE: Struts and Large ResultSet
> Date: Thu, 05 Sep 2002 07:01:34 -0700
>
> --------------------------------------------------------------------------
------
>
> I can't provide any explanation for how they've implemented things, but
one
> thing that might be interesting is that all the hits don't appear be
> viewable.  For kicks I searched on "computer" and was only able to browse
> through the first 995 of the 60.8 million results.
>
> chris
>
> > -----Original Message-----
> > From: Mazza, Glen R, PERSCOM [mailto:Glen.Mazza@hoffman.army.mil]
> > Sent: Thursday, September 05, 2002 9:17 AM
> > To: 'Struts Users Mailing List'
> > Subject: [OT] RE: Struts and Large ResultSet
> >
> >
> > Google would seem to be a very good example of how to handle
> > extremely large
> > result sets.  A search on "America", for example, returned
> > 36.2 million rows
> > kept  server-side, which the browser can quickly requery to
> > get the results,
> > 10 or so rows at a time.
> >
> > Can anyone surmise Google's probable approach to this?  Do
> > they actually
> > retain DB cursors on the server side to query an additional
> > 10 rows at a
> > time--but given their very fast response time, I suspect they
> > may be using
> > some other form of non-database cursor--I'm unsure if search
> > engines even
> > use databases to return their result sets.
> >
> > Thanks,
> > Glen
> >
> >
> > -------------------------------------------------
> >
> > Changing data will happen. I see this kinda thing happen on
> > google. You to a
> > page and then when the results update the page 5 is different
> > than it was
> > just a minute ago on the same query. It's kinda the way
> > things are I think.
> > The only way to avoid this is to keep the ResultSet open and
> > updated from
> > the database. This is not a very good solution for high traffic sites.
> >
> > Brandon
> >
> > -----Original Message-----
> > From: John Owen [mailto:johnlowen_bham@hotmail.com]
> > Sent: Thursday, August 22, 2002 9:50 AM
> > To: Struts Users Mailing List
> > Subject: Re: Struts and Large ResultSet
> >
> >
> > I suggested using the ArrayList for providing a read-only view of the
> > current state of the database. If something changes, your
> > view would remain
> > constant until you performed another query. If I were to provide
> > functionality for an item in the ArrayList, such as update, I
> > would make
> > sure the system retrieved the latest copy of the item in question.
> >
> > I would not suggest keeping a ResultSet of that size in the
> > user session. ;)
> > I also would suggest determining if you really need to query
> > 100,000 records
> > at once. If so, your J2EE container, application server or
> > client machine
> > has to be able to handle that much information. If you devise
> > cursors using
> > a row limit (like rowcount, or is it rowid/rownum?) or some
> > clever query
> > mechanism, you can pull back data in small, but meaningful groups.
> > Query-specific applications are database-dependent. I could
> > devise something
> > for Oracle 8.17 using cursors and using the limit
> > functionality, but it
> > would not apply to mysql and other databases.
> >


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [OT] RE: Struts and Large ResultSet

Posted by John Owen <jo...@hotmail.com>.
I agree with your assessment that it will take a lot of work to make an
"unbreakable MySQL". As a developer who implemented transactions in an ISAM
database, I can say that it will not be easy and it most likely won't be
unbreakable. I'm not sure if this is what they will be trying to accomplish
or if they will continue to have ISAM and Transactional versions of MySQL.

John
----- Original Message -----
From: "Eddie Bush" <ek...@swbell.net>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, September 09, 2002 3:31 PM
Subject: Re: [OT] RE: Struts and Large ResultSet


> And just above that he said:
>
> "If you want to use Oracle, by all means, please do. I think the issue
> Oracle faces is they're trying desperately to embrace Linux, and
> Oracle's "unbreakable Linux" (pitch) certainly makes a statement. My
> retort would be unbreakable MySQL."
>
> Personally, I think it's kind of insane to tout MySQL as anything near
> "unbreakable".  Unless they're ready to push some heavy funding into
> MySQL to improve it's ACID-ity, comparing MySQL to Oracle is like
> comparing apples and oranges.  Last I heard, MySQL was implementing
> atomicity -- without rollback -- LOL what *is* that?  I'd much rather
> see them push PostgreSQL or SapDB.  The argument (for MySQL still not
> being ACID compliant) is that they are still trying to figure out how to
> integrate those prinicpals without losing speed.  Maybe Sun could help
> them along; I don't know.  I know this:  you gain somewhere -- you lose
> somewhere.  ... "unbreakable MySQL" -- not unless it changes
substantially.
>
> Good thread - thanks James.  I hope my views don't offend anyone.  I'm
> not really trying to diss MySQL -- it certainly has it's applications --
> I just think touting it as a solution comparable with Oracle is ... I'm
> not going to say :-)  out of fear of offend people I respect on this
> list.  I don't think it should be done though.  There are people that
> will look to Sun and embrace whatever they see them embrace -- and just
> as whole-heartedly as Sun "seems" to.  I think embracing MySQL so
> strongly would be to their detriment ...
>
> Regards,
>
> Eddie
>
> (How precious is your data to you?  No, *really*?!)
>
> James Mitchell wrote:
>
> >Sorry for getting in late on this one.
> >
> >"I was just at Google, and Google's an all-MySQL shop. Why did they do
it?
> >Because they looked at DB2 and it was expensive and it didn't offer any
> >added value."  - Jonathan Schwartz
> >
> > Here's the full story:
> > http://news.com.com/2008-1082-947510.html
> >
> >
> >
> >James Mitchell
> >Software Engineer\Struts Evangelist
> >Struts-Atlanta, the "Open Minded Developer Network"
> >http://www.open-tools.org/struts-atlanta
> >
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [OT] MySQL vs PostgreSQL and SAP DB (was RE: Struts and Large ResultSet)

Posted by Joel Rees <jo...@alpsgiken.gr.jp>.
Peter A. J. Pilgrim commented:

> Robert J. Sanford, Jr. wrote:
> > For my money, or the lack thereof :), I would much rather use PostgreSQL or
> > SAP DB than MySQL for both feature AND, believe it or not, performance
> > reasons. One of the developers on the SourceForge project did a very nice
> > comparison of how SF would run on both MySQL and PostgreSQL and he was very
> > surprised at the results. You can read about it at:
> > http://www.phpbuilder.com/columns/tim20000705.php3. Of course, he was using
> > PHP instead of Struts :)
> > 
> 
> The article appears to be lauding MySQL features albeit 1999 on
> some speed issues. I definitely miss the subselect SQL syntax which
> is definitely useful with Oracle and Sybase.

PostgreSQL had a short thread on this:

    http://marc.theaimsgroup.com/?l=postgresql-general&m=102987283829569&w=2

You do want to follow the link to infoworld in this post, BTW

> MySQL 4.0 Beta is out and wait for it. Full Text Match capabilities.
> Is this the end of Lucene or eSearch ? No. I like the bit about
> not returning the whole table of data if the query matches more
> than half the number of rows in the database table.
> 
> As for LargeResultSets I don't think Sybase has rowset limit
> optimisation. Oracle I know a ROWID reverse keyword or is it
> ROWINDEX I cant remember.
> 
> > For my own personal work I chose PostgreSQL for several features that
> > MySQL - nested queries, views, triggers and stored procedures being the
> > biggies. Transactions weren't available with MySQL at the time I made my
> > decision but, even with their current level of support for transactions, I
> > cannot conceive of doing without the other features, views and stored
> > procedures especially.
> > 
> > And that is why I don't understand Sun's push for MySQL. Are there any
> > enterprise level projects (heck, even department level projects) that you
> > don't want to use views and stored procedures with?
> > 
> 
> Sun's push for MySQL. Where did you read about this ?

You'd have to follow a couple of links from the one above, so --

    http://www.infoworld.com/articles/hn/xml/02/08/14/020814hnmcnealyint.xml

about half-way down the page.

-- 
Joel Rees <jo...@alpsgiken.gr.jp>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [OT] MySQL vs PostgreSQL and SAP DB (was RE: Struts and Large ResultSet)

Posted by Eddie Bush <ek...@swbell.net>.
Peter A. J. Pilgrim wrote:

> Robert J. Sanford, Jr. wrote:
>
>> For my money, or the lack thereof :), I would much rather use 
>> PostgreSQL or
>> SAP DB than MySQL for both feature AND, believe it or not, performance
>> reasons. One of the developers on the SourceForge project did a very 
>> nice
>> comparison of how SF would run on both MySQL and PostgreSQL and he 
>> was very
>> surprised at the results. You can read about it at:
>> http://www.phpbuilder.com/columns/tim20000705.php3. Of course, he was 
>> using
>> PHP instead of Struts :)
>
> The article appears to be lauding MySQL features albeit 1999 on
> some speed issues. I definitely miss the subselect SQL syntax which
> is definitely useful with Oracle and Sybase.
>
> MySQL 4.0 Beta is out and wait for it. Full Text Match capabilities.
> Is this the end of Lucene or eSearch ? No. I like the bit about
> not returning the whole table of data if the query matches more
> than half the number of rows in the database table. 

... I personally think a DBMS should give you what you ask for :-)  I've 
seen enough times when I actually *did* need to pull back that much 
data, that it would really tick me off if my DBMS made such a judgement 
call for me.  That seems quite arrogant to me ... It should be the 
developer's job to determine what comes back; not the DBMS's job.

> As for LargeResultSets I don't think Sybase has rowset limit
> optimisation. Oracle I know a ROWID reverse keyword or is it
> ROWINDEX I cant remember.

PostgreSQL has this functionality too -- and it's ACID-compliant.

>> For my own personal work I chose PostgreSQL for several features that
>> MySQL - nested queries, views, triggers and stored procedures being the
>> biggies. Transactions weren't available with MySQL at the time I made my
>> decision but, even with their current level of support for 
>> transactions, I
>> cannot conceive of doing without the other features, views and stored
>> procedures especially.
>>
>> And that is why I don't understand Sun's push for MySQL. Are there any
>> enterprise level projects (heck, even department level projects) that 
>> you
>> don't want to use views and stored procedures with?
>
> Sun's push for MySQL. Where did you read about this ?

 Here's the full story:
 http://news.com.com/2008-1082-947510.html

>> rjsjr
>>
> Well ISP / Java WebHoster only support MySQL, so I got no choice. 

You should (generally) be able to get them to provide you with 
PostgreSQL too.  I'd be shocked if it wasn't already installed.  SapDB 
is quite hot nowadays too, from my understanding.  Go with a DBMS that 
passes the ACID test ... unless you honestly think you "don't need all 
that stuff".  (I've heard many folks say they don't need an 
ACID-compliant DBMS; I've never understood the statement.  For certain 
confined applications you may not, but overall I think it is [or should 
be] a requirement)

Regards,

Eddie



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [OT] MySQL vs PostgreSQL and SAP DB (was RE: Struts and Large ResultSet)

Posted by "Peter A. J. Pilgrim" <pe...@xenonsoft.demon.co.uk>.
Robert J. Sanford, Jr. wrote:
> For my money, or the lack thereof :), I would much rather use PostgreSQL or
> SAP DB than MySQL for both feature AND, believe it or not, performance
> reasons. One of the developers on the SourceForge project did a very nice
> comparison of how SF would run on both MySQL and PostgreSQL and he was very
> surprised at the results. You can read about it at:
> http://www.phpbuilder.com/columns/tim20000705.php3. Of course, he was using
> PHP instead of Struts :)
> 

The article appears to be lauding MySQL features albeit 1999 on
some speed issues. I definitely miss the subselect SQL syntax which
is definitely useful with Oracle and Sybase.

MySQL 4.0 Beta is out and wait for it. Full Text Match capabilities.
Is this the end of Lucene or eSearch ? No. I like the bit about
not returning the whole table of data if the query matches more
than half the number of rows in the database table.

As for LargeResultSets I don't think Sybase has rowset limit
optimisation. Oracle I know a ROWID reverse keyword or is it
ROWINDEX I cant remember.

> For my own personal work I chose PostgreSQL for several features that
> MySQL - nested queries, views, triggers and stored procedures being the
> biggies. Transactions weren't available with MySQL at the time I made my
> decision but, even with their current level of support for transactions, I
> cannot conceive of doing without the other features, views and stored
> procedures especially.
> 
> And that is why I don't understand Sun's push for MySQL. Are there any
> enterprise level projects (heck, even department level projects) that you
> don't want to use views and stored procedures with?
> 

Sun's push for MySQL. Where did you read about this ?

> rjsjr
> 

Well ISP / Java WebHoster only support MySQL, so I got no choice.


-- 
Peter Pilgrim         +-----\ +-++----++----+
Java Technologist     |     | | ||    ||    | 'n' Shine
                       |  O  | | ||  --+| ---+
         /\            | ._  / | | \  \ |    |
        /  \           | | \ \ | |+--  || ---+ A new day
       /_  _\  "Up"    | | | | | ||    ||    | is coming
         ||            +-+ +-+ +-++----++----+
<home page="http://www.xenonsoft.demon.co.uk/" />


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [OT] MySQL vs PostgreSQL and SAP DB (was RE: Struts and Large ResultSet)

Posted by "Robert J. Sanford, Jr." <rs...@trefs.com>.
For my money, or the lack thereof :), I would much rather use PostgreSQL or
SAP DB than MySQL for both feature AND, believe it or not, performance
reasons. One of the developers on the SourceForge project did a very nice
comparison of how SF would run on both MySQL and PostgreSQL and he was very
surprised at the results. You can read about it at:
http://www.phpbuilder.com/columns/tim20000705.php3. Of course, he was using
PHP instead of Struts :)

For my own personal work I chose PostgreSQL for several features that
MySQL - nested queries, views, triggers and stored procedures being the
biggies. Transactions weren't available with MySQL at the time I made my
decision but, even with their current level of support for transactions, I
cannot conceive of doing without the other features, views and stored
procedures especially.

And that is why I don't understand Sun's push for MySQL. Are there any
enterprise level projects (heck, even department level projects) that you
don't want to use views and stored procedures with?

rjsjr

> -----Original Message-----
> From: Eddie Bush [mailto:ekbush@swbell.net]
> Sent: Monday, September 09, 2002 3:31 PM
> To: Struts Users Mailing List
> Subject: Re: [OT] RE: Struts and Large ResultSet
>
>
> And just above that he said:
>
> "If you want to use Oracle, by all means, please do. I think the issue
> Oracle faces is they're trying desperately to embrace Linux, and
> Oracle's "unbreakable Linux" (pitch) certainly makes a statement. My
> retort would be unbreakable MySQL."
>
> Personally, I think it's kind of insane to tout MySQL as anything near
> "unbreakable".  Unless they're ready to push some heavy funding into
> MySQL to improve it's ACID-ity, comparing MySQL to Oracle is like
> comparing apples and oranges.  Last I heard, MySQL was implementing
> atomicity -- without rollback -- LOL what *is* that?  I'd much rather
> see them push PostgreSQL or SapDB.  The argument (for MySQL still not
> being ACID compliant) is that they are still trying to figure out how to
> integrate those prinicpals without losing speed.  Maybe Sun could help
> them along; I don't know.  I know this:  you gain somewhere -- you lose
> somewhere.  ... "unbreakable MySQL" -- not unless it changes
> substantially.
>
> Good thread - thanks James.  I hope my views don't offend anyone.  I'm
> not really trying to diss MySQL -- it certainly has it's applications --
> I just think touting it as a solution comparable with Oracle is ... I'm
> not going to say :-)  out of fear of offend people I respect on this
> list.  I don't think it should be done though.  There are people that
> will look to Sun and embrace whatever they see them embrace -- and just
> as whole-heartedly as Sun "seems" to.  I think embracing MySQL so
> strongly would be to their detriment ...
>
> Regards,
>
> Eddie
>
> (How precious is your data to you?  No, *really*?!)
>
> James Mitchell wrote:
>
> >Sorry for getting in late on this one.
> >
> >"I was just at Google, and Google's an all-MySQL shop. Why did
> they do it?
> >Because they looked at DB2 and it was expensive and it didn't offer any
> >added value."  - Jonathan Schwartz
> >
> > Here's the full story:
> > http://news.com.com/2008-1082-947510.html
> >
> >
> >
> >James Mitchell
> >Software Engineer\Struts Evangelist
> >Struts-Atlanta, the "Open Minded Developer Network"
> >http://www.open-tools.org/struts-atlanta
> >
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [OT] RE: Struts and Large ResultSet

Posted by Eddie Bush <ek...@swbell.net>.
And just above that he said:

"If you want to use Oracle, by all means, please do. I think the issue 
Oracle faces is they're trying desperately to embrace Linux, and 
Oracle's "unbreakable Linux" (pitch) certainly makes a statement. My 
retort would be unbreakable MySQL."

Personally, I think it's kind of insane to tout MySQL as anything near 
"unbreakable".  Unless they're ready to push some heavy funding into 
MySQL to improve it's ACID-ity, comparing MySQL to Oracle is like 
comparing apples and oranges.  Last I heard, MySQL was implementing 
atomicity -- without rollback -- LOL what *is* that?  I'd much rather 
see them push PostgreSQL or SapDB.  The argument (for MySQL still not 
being ACID compliant) is that they are still trying to figure out how to 
integrate those prinicpals without losing speed.  Maybe Sun could help 
them along; I don't know.  I know this:  you gain somewhere -- you lose 
somewhere.  ... "unbreakable MySQL" -- not unless it changes substantially.

Good thread - thanks James.  I hope my views don't offend anyone.  I'm 
not really trying to diss MySQL -- it certainly has it's applications -- 
I just think touting it as a solution comparable with Oracle is ... I'm 
not going to say :-)  out of fear of offend people I respect on this 
list.  I don't think it should be done though.  There are people that 
will look to Sun and embrace whatever they see them embrace -- and just 
as whole-heartedly as Sun "seems" to.  I think embracing MySQL so 
strongly would be to their detriment ...

Regards,

Eddie

(How precious is your data to you?  No, *really*?!)

James Mitchell wrote:

>Sorry for getting in late on this one.
>
>"I was just at Google, and Google's an all-MySQL shop. Why did they do it?
>Because they looked at DB2 and it was expensive and it didn't offer any
>added value."  - Jonathan Schwartz
>
> Here's the full story:
> http://news.com.com/2008-1082-947510.html
>
>
>
>James Mitchell
>Software Engineer\Struts Evangelist
>Struts-Atlanta, the "Open Minded Developer Network"
>http://www.open-tools.org/struts-atlanta
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [OT] RE: Struts and Large ResultSet

Posted by Michael Lee <ml...@hotmail.com>.
The way I've done it is similar to number 2 but I did it all in Java using
cursors. I execute the query every time the user clicks next/previous. I
setFetchSize() instead of setCursorName(). Not sure how this will work as it
is a work in progress.

----- Original Message -----
From: "Eddie Bush" <ek...@swbell.net>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, September 09, 2002 11:43 AM
Subject: Re: [OT] RE: Struts and Large ResultSet


> Two choices:
>     1)  Write a stored procedure
>         - will still have to muddle through the rows at the beginning of
> the result before it starts giving you what you want
>         - still database dependent
>     2)  Use a DBMS that provides the START, LIMIT options for the SELECT
> clause (like PostgreSQL)
>         - still database dependent
>         - works quite well (this is mature functionality)
>         - *only* retrieves those rows you ask for (you don't have to
> wade through the ones you've already seen)
>
> ... if you really want to *just* bring back twenty rows out of 2
> million, it seems that (2) offers the best solution.  Yes, it's tightly
> coupled to a given DBMS.  That DBMS is open source, and quite good
> though.  (I'm nearly certain there are OS DBMS implementations other
> than PostgreSQL that offer this functionality, but none come to mind.)
>
> If database independence is your primary goal, I'd suggest you go with
> something like OJB (http://jakarta.apache.org/ojb).  You can utilize
> "lazy loading" of dependent data to help stream-line your results (only
> the PKs will be retrieved; full objects are materialized on access)
>
> Regards,
>
> Eddie
>
> Ashish Kulkarni wrote:
>
> >Hi,
> >But is there a way to write some thing, which is
> >database independent, so u can change the database
> >without any code modification,
> >what i am trying it using CachedRowSet, i load the
> >resultset into a cachedrowset and then display it page
> >by page,
> >now only think i have to figure is, how can i load
> >only few records in this rowset, like if i have 1
> >million records, just load say 1000 records, iterate
> >through them, if u reach end of cache load another
> >1000, and so,
> >since a user will never go through a process of seeing
> >million records at a time, may be 1000 the max...
> >most user will use some thing like "Go To" to point at
> >a specific record in database,
> >I hope this thing works out well
> >Ashish
> >
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [OT] RE: Struts and Large ResultSet

Posted by Eddie Bush <ek...@swbell.net>.
Two choices:
    1)  Write a stored procedure
        - will still have to muddle through the rows at the beginning of 
the result before it starts giving you what you want
        - still database dependent
    2)  Use a DBMS that provides the START, LIMIT options for the SELECT 
clause (like PostgreSQL)
        - still database dependent
        - works quite well (this is mature functionality)
        - *only* retrieves those rows you ask for (you don't have to 
wade through the ones you've already seen)

... if you really want to *just* bring back twenty rows out of 2 
million, it seems that (2) offers the best solution.  Yes, it's tightly 
coupled to a given DBMS.  That DBMS is open source, and quite good 
though.  (I'm nearly certain there are OS DBMS implementations other 
than PostgreSQL that offer this functionality, but none come to mind.)

If database independence is your primary goal, I'd suggest you go with 
something like OJB (http://jakarta.apache.org/ojb).  You can utilize 
"lazy loading" of dependent data to help stream-line your results (only 
the PKs will be retrieved; full objects are materialized on access)

Regards,

Eddie

Ashish Kulkarni wrote:

>Hi,
>But is there a way to write some thing, which is
>database independent, so u can change the database
>without any code modification,
>what i am trying it using CachedRowSet, i load the
>resultset into a cachedrowset and then display it page
>by page,
>now only think i have to figure is, how can i load
>only few records in this rowset, like if i have 1
>million records, just load say 1000 records, iterate
>through them, if u reach end of cache load another
>1000, and so,
>since a user will never go through a process of seeing
>million records at a time, may be 1000 the max...
>most user will use some thing like "Go To" to point at
>a specific record in database,
>I hope this thing works out well
>Ashish
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [OT] RE: Struts and Large ResultSet

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi,
I am developing an web interface to existing AS400
system, so there is no way i can go to MYSQL or
suggest to change database, i have to live with AS400
and DB2 and try to find a way out
thanx for suggestion

--- "Peter A. J. Pilgrim"
<pe...@xenonsoft.demon.co.uk> wrote:
> Ashish Kulkarni wrote:
> > Hi,
> > But is there a way to write some thing, which is
> > database independent, so u can change the database
> > without any code modification,
> > what i am trying it using CachedRowSet, i load the
> > resultset into a cachedrowset and then display it
> page
> > by page,
> > now only think i have to figure is, how can i load
> > only few records in this rowset, like if i have 1
> > million records, just load say 1000 records,
> iterate
> > through them, if u reach end of cache load another
> > 1000, and so,
> > since a user will never go through a process of
> seeing
> > million records at a time, may be 1000 the max...
> > most user will use some thing like "Go To" to
> point at
> > a specific record in database,
> > I hope this thing works out well
> > Ashish
> 
> 
> Then you need something like MYSQL which has special
> reserved word to help you limit the size of the
> results.
> 
> SELECT LAST_NAME, FIRST_NAME, DEPT FROM
> COMPANY_EMPLOYEES
>     ORDER BY LAST_NAME
>     GROUP BY DEPT
>     LIMIT <offset>, <number-of-rows>
> 
> The "LIMIT" word get you a finite rowset limitation
> efficiently on the Database server side. Without
> this
> you may have to read the entire data set out of the
> database. Say you only interested in rows 30 to 40
> then you discard 30 rows already as in normal JDBC
> programming and then kill off the query and result
> after reading row 439.  Suppose the database table
> has 10000 rows, then the database server may in
> efficient
> allocate the time and memory for 1000 rows to read
> by the client. But you stopped on row 40, what
> a waste with 960 unused records!
> 
> So in a nutshell go with MYSQL
> 
> SELECT CASH_IN, CASH_OUT, INVOICE, CUSTOMER
>   FROM BOOK_BALANCE
> 	LIMIT 30, 10
> 
> a la google.com
> 
> Or I think Oracle my have ROWINDEX attribute.
> 
> ROWINDEX >= 30 and ROWINDEX < 40.
> 
> Sybase and Postgres I dunno.
> 
> -- 
> Peter Pilgrim         +-----\ +-++----++----+
> Java Technologist     |     | | ||    ||    | 'n'
> Shine
>                        |  O  | | ||  --+| ---+
>          /\            | ._  / | | \  \ |    |
>         /  \           | | \ \ | |+--  || ---+ A new
> day
>        /_  _\  "Up"    | | | | | ||    ||    | is
> coming
>          ||            +-+ +-+ +-++----++----+
> <home page="http://www.xenonsoft.demon.co.uk/" />
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


=====
A$HI$H

__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [OT] RE: Struts and Large ResultSet

Posted by "Peter A. J. Pilgrim" <pe...@xenonsoft.demon.co.uk>.
Ashish Kulkarni wrote:
> Hi,
> But is there a way to write some thing, which is
> database independent, so u can change the database
> without any code modification,
> what i am trying it using CachedRowSet, i load the
> resultset into a cachedrowset and then display it page
> by page,
> now only think i have to figure is, how can i load
> only few records in this rowset, like if i have 1
> million records, just load say 1000 records, iterate
> through them, if u reach end of cache load another
> 1000, and so,
> since a user will never go through a process of seeing
> million records at a time, may be 1000 the max...
> most user will use some thing like "Go To" to point at
> a specific record in database,
> I hope this thing works out well
> Ashish


Then you need something like MYSQL which has special
reserved word to help you limit the size of the results.

SELECT LAST_NAME, FIRST_NAME, DEPT FROM COMPANY_EMPLOYEES
    ORDER BY LAST_NAME
    GROUP BY DEPT
    LIMIT <offset>, <number-of-rows>

The "LIMIT" word get you a finite rowset limitation
efficiently on the Database server side. Without this
you may have to read the entire data set out of the
database. Say you only interested in rows 30 to 40
then you discard 30 rows already as in normal JDBC
programming and then kill off the query and result
after reading row 439.  Suppose the database table
has 10000 rows, then the database server may in efficient
allocate the time and memory for 1000 rows to read
by the client. But you stopped on row 40, what
a waste with 960 unused records!

So in a nutshell go with MYSQL

SELECT CASH_IN, CASH_OUT, INVOICE, CUSTOMER
  FROM BOOK_BALANCE
	LIMIT 30, 10

a la google.com

Or I think Oracle my have ROWINDEX attribute.

ROWINDEX >= 30 and ROWINDEX < 40.

Sybase and Postgres I dunno.

-- 
Peter Pilgrim         +-----\ +-++----++----+
Java Technologist     |     | | ||    ||    | 'n' Shine
                       |  O  | | ||  --+| ---+
         /\            | ._  / | | \  \ |    |
        /  \           | | \ \ | |+--  || ---+ A new day
       /_  _\  "Up"    | | | | | ||    ||    | is coming
         ||            +-+ +-+ +-++----++----+
<home page="http://www.xenonsoft.demon.co.uk/" />


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [OT] RE: Struts and Large ResultSet

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi,
But is there a way to write some thing, which is
database independent, so u can change the database
without any code modification,
what i am trying it using CachedRowSet, i load the
resultset into a cachedrowset and then display it page
by page,
now only think i have to figure is, how can i load
only few records in this rowset, like if i have 1
million records, just load say 1000 records, iterate
through them, if u reach end of cache load another
1000, and so,
since a user will never go through a process of seeing
million records at a time, may be 1000 the max...
most user will use some thing like "Go To" to point at
a specific record in database,
I hope this thing works out well
Ashish
--- James Mitchell <jm...@telocity.com> wrote:
> Sorry for getting in late on this one.
> 
> "I was just at Google, and Google's an all-MySQL
> shop. Why did they do it?
> Because they looked at DB2 and it was expensive and
> it didn't offer any
> added value."  - Jonathan Schwartz
> 
>  Here's the full story:
>  http://news.com.com/2008-1082-947510.html
> 
> 
> 
> James Mitchell
> Software Engineer\Struts Evangelist
> Struts-Atlanta, the "Open Minded Developer Network"
> http://www.open-tools.org/struts-atlanta
> 
> 
> 
> > From: Bartley, Chris P
> > Subject: RE: [OT] RE: Struts and Large ResultSet
> > Date: Thu, 05 Sep 2002 07:01:34 -0700
> >
> >
>
--------------------------------------------------------------------------
> ------
> >
> > I can't provide any explanation for how they've
> implemented things, but
> one
> > thing that might be interesting is that all the
> hits don't appear be
> > viewable.  For kicks I searched on "computer" and
> was only able to browse
> > through the first 995 of the 60.8 million results.
> >
> > chris
> >
> > > -----Original Message-----
> > > From: Mazza, Glen R, PERSCOM
> [mailto:Glen.Mazza@hoffman.army.mil]
> > > Sent: Thursday, September 05, 2002 9:17 AM
> > > To: 'Struts Users Mailing List'
> > > Subject: [OT] RE: Struts and Large ResultSet
> > >
> > >
> > > Google would seem to be a very good example of
> how to handle
> > > extremely large
> > > result sets.  A search on "America", for
> example, returned
> > > 36.2 million rows
> > > kept  server-side, which the browser can quickly
> requery to
> > > get the results,
> > > 10 or so rows at a time.
> > >
> > > Can anyone surmise Google's probable approach to
> this?  Do
> > > they actually
> > > retain DB cursors on the server side to query an
> additional
> > > 10 rows at a
> > > time--but given their very fast response time, I
> suspect they
> > > may be using
> > > some other form of non-database cursor--I'm
> unsure if search
> > > engines even
> > > use databases to return their result sets.
> > >
> > > Thanks,
> > > Glen
> > >
> > >
> > >
> -------------------------------------------------
> > >
> > > Changing data will happen. I see this kinda
> thing happen on
> > > google. You to a
> > > page and then when the results update the page 5
> is different
> > > than it was
> > > just a minute ago on the same query. It's kinda
> the way
> > > things are I think.
> > > The only way to avoid this is to keep the
> ResultSet open and
> > > updated from
> > > the database. This is not a very good solution
> for high traffic sites.
> > >
> > > Brandon
> > >
> > > -----Original Message-----
> > > From: John Owen
> [mailto:johnlowen_bham@hotmail.com]
> > > Sent: Thursday, August 22, 2002 9:50 AM
> > > To: Struts Users Mailing List
> > > Subject: Re: Struts and Large ResultSet
> > >
> > >
> > > I suggested using the ArrayList for providing a
> read-only view of the
> > > current state of the database. If something
> changes, your
> > > view would remain
> > > constant until you performed another query. If I
> were to provide
> > > functionality for an item in the ArrayList, such
> as update, I
> > > would make
> > > sure the system retrieved the latest copy of the
> item in question.
> > >
> > > I would not suggest keeping a ResultSet of that
> size in the
> > > user session. ;)
> > > I also would suggest determining if you really
> need to query
> > > 100,000 records
> > > at once. If so, your J2EE container, application
> server or
> > > client machine
> > > has to be able to handle that much information.
> If you devise
> > > cursors using
> > > a row limit (like rowcount, or is it
> rowid/rownum?) or some
> > > clever query
> > > mechanism, you can pull back data in small, but
> meaningful groups.
> > > Query-specific applications are
> database-dependent. I could
> > > devise something
> > > for Oracle 8.17 using cursors and using the
> limit
> > > functionality, but it
> > > would not apply to mysql and other databases.
> > >
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


=====
A$HI$H

__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>