Hola, aprovechando el hilo.Les comento mi caso, existe una tabla en una
base de datos SQL Server de nombre SFT_MAEPROD en la que se almacena la
informacion de los productos que vende la empresa (ropa).

Esta tabla tenie mas de 100 campos y no esta normalizada, en verdad todas
las tablas de esta base de datos en SQL Server no estan normalizadas.

Se esta creando una nueva base de datos en PostgreSQL para dejar de usar ya
el SQL Server.

Una vez que se termine de hacer la migración de información de SQL Server a
PostgreSQL, tendre que armar consultas y reportes (JOINS) con distintos
tipos de filtros, necesitare indices para tener un tiempo de respuesta
favorable

He normalizado esta tabla SFT_MAEPROD en PostgreSQL, y he pensado crear
indices, mi idea es que quede asi:

CREATE TABLE public.sft_maesede (
  id_sft_sede   serial NOT NULL PRIMARY KEY, -->id sede
  nom_sft_sede  varchar(50), --nombre sede

CREATE TABLE public.sft_maealma (
  id_sft_alma    serial NOT NULL PRIMARY KEY, --> id almacen
  id_sft_sede    integer NOT NULL,  --id sede ----> (CREAR INDICE)
  nom_sft_alma   varchar(50), --nombre almacen

CREATE TABLE public.sft_maeprod (
  id_sft_prod      bigserial NOT NULL PRIMARY KEY, -->id producto
  id_sft_fami      integer NOT NULL,  --id familia      ----> (CREAR
INDICE)
  id_sft_clas      integer NOT NULL,  --id clase        ----> (CREAR
INDICE)
  id_sft_mode      integer NOT NULL,  --id modelo   ----> (CREAR INDICE)
  id_sft_line      integer NOT NULL,  --id linea         ----> (CREAR
INDICE)
  id_sft_mate      integer NOT NULL,  --id material  ----> (CREAR INDICE)
  id_sft_colo      integer NOT NULL,  --id color        ----> (CREAR
INDICE)
  id_sft_tall      integer NOT NULL,  --id talla           ----> (CREAR
INDICE)
  id_sft_temp      integer NOT NULL,  --id temporada  ----> (CREAR INDICE)
  id_sft_gene      integer NOT NULL,  --id genero   ----> (CREAR INDICE)
  id_sft_pres      integer NOT NULL,  --id presentacion  ----> (CREAR
INDICE)
  nom_stf_prod     varchar(100),      --nombre producto ----> (CREAR
INDICE)

CREATE TABLE public.sft_prodxalm (
  id_sft_codi      bigserial NOT NULL PRIMARY KEY, --> id
  id_sft_sede      integer NOT NULL,  --id sede          ----> (CREAR
INDICE)
  id_sft_alma      integer NOT NULL,  --id almacen    ----> (CREAR INDICE)
  id_sft_prod      bigint NOT NULL,   --id producto     ----> (CREAR
INDICE)

Estoy en lo correcto?,

Espero sus comentarios.

Saludos.

Responder a