Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Most Performant way of performing slow sql query

Re: Most Performant way of performing slow sql query

From: Frank Piron <empty_at_zero.nil>
Date: Thu, 23 Dec 2004 14:34:25 +0100
Message-ID: <opsjgqnnfhm0et4w@news.online.de>


Hi,

Am 23 Dec 2004 04:49:27 -0800 schrieb C Foy <foymail_at_uk2.net>:

> Hi All,
>
> I need some help to find an optimal way to perfom the following :
>
> Given a table sydsession with column sessionid which contains numeric
> data between 0 and 65535
>
> problem: I need to find the most performant way of performing the
> following query -
> want to select a sessionid between 0 and 65535 that is not present in
> the table sydsession (sorted from 0 to 65535)
vious):
>
> SELECT MIN(sydsessionid) FROM (SELECT sydsessionid from counters MINUS
> SELECT DISTINCT sydsessionid FROM sydsession WHERE sydsessionid
> BETWEEN 0 AND 65535);
You should redesign your data model for accessing the "smallest free sessionid" via index path.

Or other (and better) strategy. Write a function get_sessionid which uses an oracle sequence. This function has to reset the sequence if .nextval=65535.

-- 
Frank Piron,
defrankatkonaddot
(leftrotate two)
Received on Thu Dec 23 2004 - 07:34:25 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US