pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Mª José Sempere <mjose@pixelart.es>
Cc: pgsql-admin@postgresql.org
Subject: Re: pgcrypto module for WINDOWS
Date: Fri, 10 Dec 2004 21:14:10 -0800
Message-ID: <41BA8222.8000409@joeconway.com> (raw)
In-Reply-To: <000501c4de9f$b3c90ac0$0900a8c0@mj>
References: <000501c4de9f$b3c90ac0$0900a8c0@mj>

Mª José Sempere wrote:
> We are interested in installing the pgcrypto module of PostgreSQL for
>  Windows, In order to use the function digest() for creating index on
> bytea type fields:
> 
> create unique index my_index on my_table (digest(my_bytea_field,
> 'md5'));


Um, why would you want to use digest() just so that you can index a 
bytea field?

regression=# select version();
                           version
-----------------------------------------------------------------------
  PostgreSQL 7.4.5 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.3 
20040412 (Red Hat Linux 3.3.3-7)
(1 row)

regression=# create table foo(f1 bytea, f2 text);
CREATE TABLE
regression=# create unique index idx1 on foo(f1);
CREATE INDEX
regression=# insert into foo values('abc\\001\\002xyz');
INSERT 32018907 1
regression=# set enable_seqscan to off;
SET
regression=# explain analyze select * from foo where f1 = 
'abc\\001\\002xyz';
                           QUERY PLAN
------------------------------------------------------------------------
  Index Scan using idx1 on foo  (cost=0.00..4.82 rows=2 width=64) 
(actual time=0.026..0.030 rows=1 loops=1)
    Index Cond: (f1 = 'abc\\001\\002xyz'::bytea)
  Total runtime: 0.114 ms
(3 rows)


HTH,

Joe



view thread (4+ messages)  latest in thread

Message-ID: <41BA8222.8000409@joeconway.com>
Permalink:  ../41BA8222.8000409@joeconway.com/
Also on:    postgresql.org/message-id/41BA8222.8000409@joeconway.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mail@joeconway.com, mjose@pixelart.es
  Subject: Re: pgcrypto module for WINDOWS
  In-Reply-To: <41BA8222.8000409@joeconway.com>
  References: <000501c4de9f$b3c90ac0$0900a8c0@mj> <41BA8222.8000409@joeconway.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox