Hasta tonde tengo entendido, para operaciones de igualdad y más cuando lo que se utilizan son números, como es tu caso, lo mas óptimo y recomendado es utilizar un índice de tipo btree.
saludos a todos. ________________________________________ De: [email protected] [[email protected]] En nombre de Pedro PG [[email protected]] Enviado el: martes, 29 de octubre de 2013 10:45 Para: [email protected] Asunto: RE: [pgsql-es-ayuda] Indices en tablas Bueno la tabla tendrá miles de registros y sera consultada frecuentemente, es por eso que había pensado en poner un indice, ahora lo del tema de HASH lo estoy usando porque hasta donde se, es recomendable usarlo para consultas donde se use el operador = ... en todo caso que tipo de indice puedo usar. Gracias. > From: [email protected] > Date: Tue, 29 Oct 2013 10:10:46 -0500 > Subject: Re: [pgsql-es-ayuda] Indices en tablas > To: [email protected] > CC: [email protected] > > 2013/10/29 Pedro PG <[email protected]>: > > 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 ([email protected]) > Para cambiar tu suscripción: > http://www.postgresql.org/mailpref/pgsql-es-ayuda ________________________________ Fin a la injusticia, LIBERTAD AHORA A NUESTROS CINCO COMPATRIOTAS QUE SE ENCUENTRAN INJUSTAMENTE EN PRISIONES DE LOS EEUU! http://www.antiterroristas.cu http://justiciaparaloscinco.wordpress.com Fin a la injusticia, LIBERTAD AHORA A NUESTROS CINCO COMPATRIOTAS QUE SE ENCUENTRAN INJUSTAMENTE EN PRISIONES DE LOS EEUU! http://www.antiterroristas.cu http://justiciaparaloscinco.wordpress.com - Enviado a la lista de correo pgsql-es-ayuda ([email protected]) Para cambiar tu suscripción: http://www.postgresql.org/mailpref/pgsql-es-ayuda
