Skip to Main Content

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 due to inactivity on Nov 25 2015
Added on Oct 20 2015
9 comments
4,859 views