El tema de los indices es relativo, debes crear indices donde realmente
necesites . Normar una tabla no implica necesariamente crear indices a
diestra y siniestra

Para saber si necesitas un indice o no, primero debes tener clara la query,
hacer un explain y dependiendo del resultado de ese explain recien ver si
necesitas un indice o no.

Si tienes 100 registros en una tabla (por ejemplo) y una consulta va a
traer 90 de estos, dudo mucho que al optimizador considere utilizar algun
indice

Saludos

El 26 de julio de 2016, 14:35, Edwin Quijada <listas_quij...@hotmail.com>
escribió:

> LO primero es porque no poner los nombres completos y no usar
> abreviaciones de los campos?
>
>
>
>
> ------------------------------
> *From:* pgsql-es-ayuda-ow...@postgresql.org <
> pgsql-es-ayuda-ow...@postgresql.org> on behalf of Herman Estaban <
> hermanesta...@gmail.com>
> *Sent:* Thursday, June 23, 2016 5:48 PM
> *To:* Gerardo Herzig; Alberto Cuevas
> *Cc:* pgsql
> *Subject:* Re: [pgsql-es-ayuda] Pregunta sobre indices
>
> 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