• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Suggest me a best way to do this

 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I am querying a large table with millions of record based on some condition. Say this results in a 70 thousand records. Then again this 70 thousand records are filtered based on 2 three levels of conditions and finally I get a 30 thousand records.
I want to achieve pagination and I should not hit the database again as well,Currently I do this way.
I read all the 30 thousand records and store all the records in a file. I just use file pointers and manipulate things and achieve pagination to show 1000 records per page. Whenever the user request for the next page, I go to the file read it and display the next page and so on
But I feel this is not the efficent way to do this as I get lot of errors while I do paginations because of the file pointers.
Can somebody enlight me by suggesting an efficent method to do this.

Thanks in Advance

Regards,
Sivaraman.L
 
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What database do you use?

If you use MYSQL the limit clause should be something for you to look into
 
Sivaraman Lakshmanan
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I use DB2 7.0. as the Database

Reagrds,
Sivaraman.L
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry! DB2 does not have a limit clause. Maybe there is a workaround like in MSSQL

with mysql you only select the rows that you limit

Sorry that I couldn't help you
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
db2 has:
FETCH FIRST X ROWS ONLY
which works like the limit clause.
 
roses are red, violets are blue. Some poems rhyme and some are a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic