Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Greater than more efficient than equals?

AleKaOct 20 2015 — edited Oct 28 2015

Good morning,

in our company we manage multiple client databases oracle .

Our framework "versions" records using  2  NUMBER(18) fields (lets call NSTART and NEND). So that we have, for example:

ExtId   |    NSTART  |             NEND          |....and so on

+++++++++++++++++++++++++++++++++

  1       |     1            |    10                          |.....

  1       |     10          |    12                          |....and so on

  1       |      12         | 999999999999999999 |....and so on

  2       |     67          |    789                        |....and so on

  2       |     789        | 999999999999999999 |....and so on


The record with 999999999999999999 is the "last version record".

It happens that we have to identify the last version, so we look for the NEND = 999999999999999999.

In databases  with million records, the "research" is really long and often seems to freeze...but we discovered that if we just change:

NEND = 999999999999999999

with

NEND > 999999999999999998


it is much more faster (doesnt freeze and takes just seconds, not minutes....)


Why?


Thanks

Alex

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 25 2015
Added on Oct 20 2015
9 comments
5,257 views