dbTalk Databases Forums  

Problem with returing records from DB

comp.databases.sybase comp.databases.sybase


Discuss Problem with returing records from DB in the comp.databases.sybase forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Amit Gupta
 
Posts: n/a

Default Problem with returing records from DB - 08-03-2004 , 04:12 AM






Hi,

I'm using Sybase Adaptive Server Enterprise Edition ( ver 12.5.0.3 ).

I have a big query that fetches about 128,000 records. Our application's JVM is
not good enough ( with default value of 64 M) to hold these many records ( that
are retrieved from the DB ) to overcome this problem I want to break up the
query in such a way that I get first 64,000 records in one shot and next 64,000
( ie from 64001 to 128,000 ) records in the next go so that the JVM can hold the
returing records from the database.

Increasing the size of the JVM decreases the performance of our application
significantly.

The query looks something like this:

SELECT CK.CircuitKey,
CK.CircuitName,
CK.AdminCost,
.......
.......
.......
CK.MLFRAutoErrorDetection,
CK.MLFRErrorRetryCount
FROM VCircuit VC, Circuit CK
WHERE ( VC.CircuitKey = CK.CircuitKey) AND CK.ClearCallatDest!=0x00000001
AND
( VC.CardKey1 = 0x002d864a OR VC.CardKey2 = 0x002d864a
OR VC.CardKey3 = 0x002d864a OR VC.RedundantCardKey1 = 0x002d864a
OR VC.RedundantCardKey2 = 0x002d864a ) ORDER BY CK.CircuitName


Any suggestions how I can achieve this ??

Thx in advance,
Best Regards,
Amit Gupta

Reply With Quote
  #2  
Old   
Bret Halford
 
Posts: n/a

Default Re: Problem with returing records from DB - 08-03-2004 , 03:22 PM






Amit Gupta <amitgupta (AT) lucent (DOT) com> wrote

Quote:
Hi,

I'm using Sybase Adaptive Server Enterprise Edition ( ver 12.5.0.3 ).

I have a big query that fetches about 128,000 records. Our application's JVM is
not good enough ( with default value of 64 M) to hold these many records ( that
are retrieved from the DB ) to overcome this problem I want to break up the
query in such a way that I get first 64,000 records in one shot and next 64,000
( ie from 64001 to 128,000 ) records in the next go so that the JVM can hold the
returing records from the database.

Increasing the size of the JVM decreases the performance of our application
significantly.

The query looks something like this:

SELECT CK.CircuitKey,
CK.CircuitName,
CK.AdminCost,
......
......
......
CK.MLFRAutoErrorDetection,
CK.MLFRErrorRetryCount
FROM VCircuit VC, Circuit CK
WHERE ( VC.CircuitKey = CK.CircuitKey) AND CK.ClearCallatDest!=0x00000001
AND
( VC.CardKey1 = 0x002d864a OR VC.CardKey2 = 0x002d864a
OR VC.CardKey3 = 0x002d864a OR VC.RedundantCardKey1 = 0x002d864a
OR VC.RedundantCardKey2 = 0x002d864a ) ORDER BY CK.CircuitName


Any suggestions how I can achieve this ??


http://www.isug.com/Sybase_FAQ/ASE/s....2.html#6.2.12

-bret


Reply With Quote
  #3  
Old   
Febin
 
Posts: n/a

Default Re: Problem with returing records from DB - 08-24-2004 , 09:23 PM



hi,

You can do it by declarin a cursor as

declare <cursor_name> cursor
for select * from <table_name>


open <cursor_name>

set cursor rows 64000 for <cursor_name>

fetch <cursor_name>

This time it will fetch 64000 records

again

fetch <cursor_name>

This time,it fetches from 64000 to 12800 records

-- Jerrie

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.