Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

112
Vistas
How can multiple unique in partition tabale?

I have a SQL table like below.

CREATE TABLE my_table 
(
    id serial,
    user_id int,
    order_no character varying(50),
    date_time timestamp,
    primary key (id, user_id, date_time),
    unique(user_id, order_no)
) PARTITION BY RANGE (date_time);

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 ?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

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.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda