db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernt M. Johnsen" <Bernt.John...@Sun.COM>
Subject Re: Derby, SQL 2003, UNIQUE constraints, unique indices and NULL (long)
Date Thu, 03 Nov 2005 10:15:51 GMT
>>>>>>>>>>>> Jeffrey Lichtman wrote (2005-11-02 11:46:30):
> 
> Here are some more examples, assuming that nulls are not stored in indexes:
> 
> CREATE TABLE t2 (i INTEGER, j INTEGER NOT NULL);
> CREATE INDEX idx3 on t2(i);
> CREATE UNIQUE INDEX idx4 on t2(j);
> 
> SELECT i FROM t2;  -- use index idx3 (covers query)
> SELECT j FROM t2;  -- Do a table scan

Shouldn't the last SELECT use idx4 since the index is UNIQUE *and* j
is NOT NULL?

-- 
Bernt Marius Johnsen, Database Technology Group, 
Sun Microsystems, Trondheim, Norway

Mime
View raw message