Subject Unique VS checking trigger PLUS Indices
Author nagypapi
Dear List!

I have a table (
mydate date,
data whatever(lots),
closed number(1)
);

And what I want is, that mydate should be unique only if closed=0, and
I want this check to be as fast as possible.
I somehow assume that a unique constraint is a faster check than a
trigger checking with select * from table where closed=0 and
mydate=datetoinsert
so I will (will I?) create two tables,
1: where closed>0
2: where closed=0
and a trigger on 2 so that if anyone updates closed to >0, it moves
that row to table 1.

But the question still remaines in me, because I don't know how a
unique check works, is it really faster than a checking trigger?

And another thing:
If I create an Index on (a,b) will that help select statements if I
only use 'a' (or in another case: 'a' and 'c') in where conditions?
Or if I create Indices on (a,b) and (c) will that help when using
'a','b' and 'c', or when using 'a','c'

Thank you!
John Gerevich