Skip to content
Advertisement

How can multiple unique in partition tabale?

I have a SQL table like below.

I have a table. I need to unique order_no column with user_id column. there is no any problem.

But I have to unique data_time column because of I use partition. but date_time column has to be separated with user_id and order_no.

By the way I don’t want like this unique (user_id, order_no, data_time)

How can I unique date_time in this table ?

Advertisement

Answer

There is no way to create a unique index or constraint that guarantees that order_no or user_id are unique. That is one of the drawbacks of partitioning.

You could create unique constraints on the partitions. While that doesn’t guarantee global uniqueness, it goes a long way.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement