On Tuesday, 19 January 2021 at 21:34:58 UTC+8 [email protected] wrote:

> I need to put a single value constraint on a column. So you advise me to 
> create an index and then assign it the unique constraint?
>

You normally should create only the constraint, unless you need something 
special from its index. For example, if you always use ORDER BY GS_PAYS_LIB 
DESC in your queries it would be better to create a unique index with the 
descending order before creation of the constraint. The constraint will be 
able to use that index too instead of creation of own one (with default 
ascending order).

I just informed you that you read the name of internal indes from 
somewhere; it wasn't the name of your constraint. Constraints and indexes 
are different things and information about them are reported in different 
places.

Usage of unique indexes instead of unique constraints is usually a bad 
idea. Indexes normally should only be used to improve efficiency of your 
queries; they are not standardized and they are not very portable between 
different DBMS.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/5c61f51b-6331-4253-834e-c11cd35b619bn%40googlegroups.com.

Reply via email to