X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3CFFA3A61EE for ; Sat, 11 Dec 2004 05:15:03 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23059-02 for ; Sat, 11 Dec 2004 05:14:56 +0000 (GMT) Received: from joeconway.com (wsip-24-249-201-67.sd.sd.cox.net [24.249.201.67]) by svr1.postgresql.org (Postfix) with ESMTP id E89043A1D94 for ; Sat, 11 Dec 2004 05:14:20 +0000 (GMT) Received: from [192.168.4.1] (account jconway [192.168.4.1] verified) by joeconway.com (CommuniGate Pro SMTP 4.1.8) with ESMTP-TLS id 2394894; Fri, 10 Dec 2004 21:03:11 -0800 Message-ID: <41BA8222.8000409@joeconway.com> Date: Fri, 10 Dec 2004 21:14:10 -0800 From: Joe Conway User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040922 X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-1?Q?M=AA_Jos=E9_Sempere?= Cc: pgsql-admin@postgresql.org Subject: Re: pgcrypto module for WINDOWS References: <000501c4de9f$b3c90ac0$0900a8c0@mj> In-Reply-To: <000501c4de9f$b3c90ac0$0900a8c0@mj> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200412/78 X-Sequence-Number: 15664 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