Re: Indices en tablas

From: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
To: Pedro PG <pedropg(at)outlook(dot)com>
Cc: "pgsql-es-ayuda(at)postgresql(dot)org" <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: Indices en tablas
Date: 2013-10-29 15:10:46
Message-ID: CAJKUy5jJawS_O0jwKYUHO_GmNVU3AyMkc1JY11vOzJjK+SxpyA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

2013/10/29 Pedro PG <pedropg(at)outlook(dot)com>:
> Buen día lista, tengo una consulta, tengo dos tablas (el típico maestro -
> detalle).
>
> Tabla: lugar (id serial, nombre varchar) -> id tiene un indice HASH.
> Tabla: ruta (id serial, idlugar integer) -> id tiene un indice HASH, ¿es
> necesario crear un indice en idlugar? y en el caso la respuesta sea si como
> es que deberia hacerlo.
>

No tengo la menor idea de si deberías crear ese índice. Para saber eso
necesitaríamos saber: 1) cuantos registros tendrá la tabla 2) que tan
frecuentemente se consultará por el campo idlugar y 3) que tan
selectivas serán dichas consultas.

Lo que si se, es que no deberías estar usando índices HASH

http://www.postgresql.org/docs/current/static/indexes-types.html
"""
Caution

Hash index operations are not presently WAL-logged, so hash indexes
might need to be rebuilt withREINDEX after a database crash if there
were unwritten changes. Also, changes to hash indexes are not
replicated over streaming or file-based replication after the initial
base backup, so they give wrong answers to queries that subsequently
use them. For these reasons, hash index use is presently discouraged.
"""

--
Jaime Casanova www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación
Phone: +593 4 5107566 Cell: +593 987171157

-
Enviado a la lista de correo pgsql-es-ayuda (pgsql-es-ayuda(at)postgresql(dot)org)
Para cambiar tu suscripción:
http://www.postgresql.org/mailpref/pgsql-es-ayuda

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Pedro PG 2013-10-29 15:15:27 RE: Indices en tablas
Previous Message Lazaro Ruben Garcia Martinez 2013-10-29 15:09:25 RE: maximo o valor 1 en función postgres