From: | "Wang Mike" <itlist(at)msn(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | a problem with index and user define type |
Date: | 2003-06-22 01:46:10 |
Message-ID: | BAY4-F33Kh4TtnrAIaA00009b05@hotmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi all:
I write a use define type (UUID)
typedef struct uuid
{
uint32 time_low;
uint16 time_mid;
uint16 time_hi_and_version;
uint8 clock_seq_hi_and_reserved;
uint8 clock_seq_low;
uint8 node[6];
} uuid;
make all btree index function and operator, such as
CREATE OPERATOR CLASS uuid_btree_ops
DEFAULT FOR TYPE uuid USING btree
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
OPERATOR 3 = ,
OPERATOR 4 >= ,
OPERATOR 5 > ,
FUNCTION 1 uuid_cmp(uuid, uuid),
create table test_uuid(id uuid primary key default uuid_time(), name
char(40));
but this query: select * from test_uuid where id =
'df2b10aa-a31d-11d7-9867-0050babb6029'::uuid dosn't use index
QUERY PLAN
---------------------------------------------------------------
Seq Scan on test_uuid (cost=0.00..22.50 rows=500 width=140)
Filter: (id = 'df2b10aa-a31d-11d7-9867-0050babb6029'::uuid)
why ??
source code see attachement
MikeWang
---------------------------------------------------------------------
What is uuid?
uuid is a kind of data type, provide for PostgreSQL to implement unique
id in cyberspace,
it's based one UUID URN name space IETF draft (see
doc/draft-mealling-uuid-urn-00.txt),
now, pguuid support NIL(0), Time-Base(1), Name-Base(3) and
Random-Base(4) type UUID.
It's propuse is
provide a solution
for data replication, merge, and distribute.
what is the use of uuid?
1, pguuid provide PostgreSQL a data type: uuid, it can provide unique
id in
cyberspace.
2, provide type uuid related operator (e.g. =, <>, <, >, >=, <=)
3, provide functions to generate Time-base, Name-base, Random-base and
Nil-UUID.
4, provide functions to parse uuid type.
license:
BSD
_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn
Attachment | Content-Type | Size |
---|---|---|
uuid-v2.0.1.0.tar.gz | application/x-gzip | 29.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2003-06-22 02:46:16 | Re: Two weeks to feature freeze |
Previous Message | Andrew Dunstan | 2003-06-21 22:50:06 | Re: Two weeks to feature freeze |