SELECT with OFFSET oracle

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • demoniac18
    New Member
    • Sep 2011
    • 2

    #1

    SELECT with OFFSET oracle

    I need to do SELECT query from java code on table that contains 1kkk rows , so the result set will be near 1kk rows. thats why I need to limit it, and run select query many times and each time to retrieve 10k rows only. After I get 10k rows I update it so in the next SELECT they wont be retrieved.
    The problem is - in each select oracle looking from first row in the table so it reduces the performance.
    How can I use OFFSET for avoiding oracle looking from first row and pass over already updated rows?
  • rski
    Recognized Expert Contributor
    • Dec 2006
    • 700

    #2
    To avoid seq scan (looking from the first row) you can define an index on the table. Do you have any indexes defined?

    Comment

    • demoniac18
      New Member
      • Sep 2011
      • 2

      #3
      Yes, I have default rowid in oracle as index . I can also store in java code rowid of last updated row.
      So can I use in WHERE clause rowid < last_updated_ro wid ?

      Comment

      Working...