Unix Technical Forum

simple sql using between startnumber and endnumber not performing

This is a discussion on simple sql using between startnumber and endnumber not performing within the Oracle Miscellaneous forums, part of the Oracle Database category; --> Frank van Bortel (frank.van.bortel@gmail.com) wrote: : -----BEGIN PGP SIGNED MESSAGE----- : Hash: SHA1 : Malcolm Dew-Jones wrote: : > ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 04-08-2008, 01:08 PM
Malcolm Dew-Jones
 
Posts: n/a
Default Re: simple sql using between startnumber and endnumber not performing

Frank van Bortel (frank.van.bortel@gmail.com) wrote:
: -----BEGIN PGP SIGNED MESSAGE-----
: Hash: SHA1

: Malcolm Dew-Jones wrote:
: >
: > table X
: > startnumber NUMBER
: [snip]
: > index on all four columns
: >
: > SELECT *
: > FROM X
: > WHERE '3131' BETWEEN start_helper and end_helper

: Not using index - implicit conversion - BAD!

Ok, that should be a number, I simply cut/pasted the original text of the
question above that.

The issue of trying get a useful index out of two columns of numbers will
still be the same.

(And yes, I understand that this may not be an issue here, but I've
pointed out the user needs to experiment to be sure, and the double column
number index is a thing I have had to deal with in the past, so I know
that at least some of the time, in the past, this was an issue.)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 04-08-2008, 01:08 PM
Thorsten Kettner
 
Posts: n/a
Default Re: simple sql using between startnumber and endnumber not performing

On 27 Jun., 22:19, Benjamin Sølberg <benjamin.soelb...@gmail.com>
wrote:
> Yes the numbers are infact Strings.. actually varchar2(8)
> I would very much like to change it but its an old and huge system of
> which I only have partly control.


So it's all numbers in those strings? Then I'd make an index based on
the numbers, because comparing numbers is much faster than comparing
strings.

create index num_idx on my_table ( to_number(startnumber),
to_number(endnumber) )

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:19 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com