![]() | |
![]() |
| | Thread Tools | Display Modes |
#51
| |||
| |||
|
|
On Sep 28, 9:46*pm, Ed Prochak <edproc... (AT) gmail (DOT) com> wrote: Since you are using JAVA, why not open the cursor, fetch the N rows you need and close the cursor? No offense intended, DT, but I've never been a fan of ROWNUM. It leads to wrong thinking about database results. The row count treats results like records instead of rows. And funny how it always seems to be web apps that use this most often. Can you describe what constitutes the TOP N rows? What ordering do you use? Often if you can describe the rule you can code it into the query. Ed, thanks for your advice. Because the data may contains hundreds of thousands of rows, it takes a lot of memory to read all of them. So I use "lazy read" to read only one *page at a time and when users want to see a page that is not already in memory, then I will fetch that page only. So I use the top-N to read that page. Here is what I use :http://www.oracle.com/technology/ora...o17asktom.html Thanks, DT |
#52
| |||
| |||
|
|
On Sep 28, 9:46*pm, Ed Prochak <edproc... (AT) gmail (DOT) com> wrote: Since you are using JAVA, why not open the cursor, fetch the N rows you need and close the cursor? No offense intended, DT, but I've never been a fan of ROWNUM. It leads to wrong thinking about database results. The row count treats results like records instead of rows. And funny how it always seems to be web apps that use this most often. Can you describe what constitutes the TOP N rows? What ordering do you use? Often if you can describe the rule you can code it into the query. Ed, thanks for your advice. Because the data may contains hundreds of thousands of rows, it takes a lot of memory to read all of them. So I use "lazy read" to read only one *page at a time and when users want to see a page that is not already in memory, then I will fetch that page only. So I use the top-N to read that page. Here is what I use :http://www.oracle.com/technology/ora...o17asktom.html Thanks, DT |
#53
| |||
| |||
|
|
On Sep 28, 9:46*pm, Ed Prochak <edproc... (AT) gmail (DOT) com> wrote: Since you are using JAVA, why not open the cursor, fetch the N rows you need and close the cursor? No offense intended, DT, but I've never been a fan of ROWNUM. It leads to wrong thinking about database results. The row count treats results like records instead of rows. And funny how it always seems to be web apps that use this most often. Can you describe what constitutes the TOP N rows? What ordering do you use? Often if you can describe the rule you can code it into the query. Ed, thanks for your advice. Because the data may contains hundreds of thousands of rows, it takes a lot of memory to read all of them. So I use "lazy read" to read only one *page at a time and when users want to see a page that is not already in memory, then I will fetch that page only. So I use the top-N to read that page. Here is what I use :http://www.oracle.com/technology/ora...o17asktom.html Thanks, DT |
#54
| |||
| |||
|
#55
| |||
| |||
|
#56
| |||
| |||
|
#57
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |