I solved the performance issue:
My search query was a "SELECT * from xxx where xxx like ? AND xxx like ? AND
xxx like ?, etc"

Since I am only interested in the record_id's, I changed it to "SELECT
account_id from xxx where ..."

The queries are lightning fast, now...

-cm

-----Original Message-----
From: Murphy, Chris (OTS-EDH)
Sent: Wednesday, February 07, 2001 4:37 PM
To: [EMAIL PROTECTED]
Subject: GURUS: is a session Array Bean possible?


Look at this piece of code from a JSP page:

<jsp:useBean id="queryAccounts" class="AccountBean[]" scope="session"/>

This fails miserable, but you get my point... Is there another way to make
an array persistent throughout the session?

Let me explain: Right now, I have a query that returns 25 rows at a time.
The problem is performance:
Everytime the page is accessed, via the 'next' hyperlink (which contains a
parameter that keeps track of the range of rows to query) it re-performs the
original query because I can't figure out a way to return records 25 - 50,
51-75, through SQL.

[pass 1]
For example, I perform a search query that returns 5000 rows and then I
store the record_id's into an array called index. Since I want to see the
first 25 rows, I perform 25 individual queries with the record_id's
contained in index[0] through index[25] (this part seems like it would be my
bottleneck, but it isn't). Next, I create a hyperlink that hits this very
same page, but I pass it a variable named index_range=25.
[pass 2]
Same page, I perform that same query that returns 5000 rows and the I store
the record_id's again.  Now index_range says '26', I can perform 25 more
individual queries with the record_id's contained in index[26] through
index[50]. This results in the next 25 rows.
[pass n]
Same thing, except I check for conditions where there aren't exactly 25 more
records, etc.

The obvious solution is to perform the search query once, store the
record_id's into a session-persistent array, then continue to use the 'next'
hyperlink to keep track of where we are in the record_id index.  Then
browsing through the records would be lightning fast.

      Chris Murphy
OTS Information Systems

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to