Unix Technical Forum

order by, for custom types

This is a discussion on order by, for custom types within the pgsql Hackers forums, part of the PostgreSQL category; --> On 2005-11-22, at 15:45, Tom Lane wrote: > "Kevin McArthur" <Kevin@StormTide.ca> writes: >> This is acceptable to create a ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 04-11-2008, 06:56 AM
Grzegorz Jaskiewicz
 
Posts: n/a
Default Re: order by, for custom types


On 2005-11-22, at 15:45, Tom Lane wrote:

> "Kevin McArthur" <Kevin@StormTide.ca> writes:
>> This is acceptable to create a unique constraint, however, we
>> cannot mark
>> the column unique, without defining btree operators, which clearly
>> are not
>> possible for sorting. Is there any way to base the operators based
>> on the
>> text representation of the type for strict equality (not to be
>> confused with
>> same or equivilent) and thus use that not as an ordering method,
>> but as a
>> simple equality for uniqueness.

>
> Translation: you do know how to define a sortable order (ie, generate
> the text version and compare); you're just too lazy to create the
> operators to do it ...

We do have WORKING < , > , etc operators, and ::text cast already.
Thing is, can I have btree and gist indexes at the same time ?


--
GJ

"If we knew what we were doing, it wouldn't be called Research, would
it?" - AE




---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 04-11-2008, 06:56 AM
Martijn van Oosterhout
 
Posts: n/a
Default Re: order by, for custom types

On Tue, Nov 22, 2005 at 04:24:21PM +0100, Grzegorz Jaskiewicz wrote:
> >Translation: you do know how to define a sortable order (ie, generate
> >the text version and compare); you're just too lazy to create the
> >operators to do it ...

> We do have WORKING < , > , etc operators, and ::text cast already.
> Thing is, can I have btree and gist indexes at the same time ?


Sure, did you look at the ltree example someone pointed you to?

Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQFDgzuyIB7bNG8LQkwRAscJAJ99N2JiDDr0i6rIkc8s3o Puekaf9wCfcPVb
azDybnPxs3qfCTd7Ses8CDA=
=6wKp
-----END PGP SIGNATURE-----

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 04-11-2008, 06:56 AM
Oleg Bartunov
 
Posts: n/a
Default Re: order by, for custom types

On Tue, 22 Nov 2005, Grzegorz Jaskiewicz wrote:
> Thing is, can I have btree and gist indexes at the same time ?


no, we have contrib/btree_gist for this


Regards,
Oleg
__________________________________________________ ___________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 04-11-2008, 06:56 AM
Grzegorz Jaskiewicz
 
Posts: n/a
Default Re: order by, for custom types


On 2005-11-22, at 16:39, Martijn van Oosterhout wrote:

> On Tue, Nov 22, 2005 at 04:24:21PM +0100, Grzegorz Jaskiewicz wrote:
>>> Translation: you do know how to define a sortable order (ie,
>>> generate
>>> the text version and compare); you're just too lazy to create the
>>> operators to do it ...

>> We do have WORKING < , > , etc operators, and ::text cast already.
>> Thing is, can I have btree and gist indexes at the same time ?

>
> Sure, did you look at the ltree example someone pointed you to?
>
> Have a nice day,

Ok, I hacked btree for my type, and surely I can have both btree and
gist at the same time on the same column.
/me is now going to have a look on btree_gist.

Thanks folks.

--
GJ

"If we knew what we were doing, it wouldn't be called Research, would
it?" - AE




---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 04-11-2008, 06:56 AM
Martijn van Oosterhout
 
Posts: n/a
Default Re: order by, for custom types

On Tue, Nov 22, 2005 at 05:14:35PM +0100, Grzegorz Jaskiewicz wrote:
> Ok, I hacked btree for my type, and surely I can have both btree and
> gist at the same time on the same column.
> /me is now going to have a look on btree_gist.


You don't actually have to have a btree defined on your column for
ORDER BY to work, you just need to define a btree OPERATOR CLASS so
that PostgreSQL knows what you mean by "ORDER BY".

Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQFDg0StIB7bNG8LQkwRAlfCAJ0U1HWh61E7llmBIUejZq YMFHZr4QCcDQ+b
0jMV5EQzETo1+gN5VIv6xoY=
=gFnW
-----END PGP SIGNATURE-----

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #16 (permalink)  
Old 04-11-2008, 06:56 AM
Grzegorz Jaskiewicz
 
Posts: n/a
Default Re: order by, for custom types


On 2005-11-22, at 17:17, Martijn van Oosterhout wrote:

> On Tue, Nov 22, 2005 at 05:14:35PM +0100, Grzegorz Jaskiewicz wrote:
>> Ok, I hacked btree for my type, and surely I can have both btree and
>> gist at the same time on the same column.
>> /me is now going to have a look on btree_gist.

>
> You don't actually have to have a btree defined on your column for
> ORDER BY to work, you just need to define a btree OPERATOR CLASS so
> that PostgreSQL knows what you mean by "ORDER BY".

yep, I know. Thanks.
Anyhow, I wanted to see if having two indexes will make it faster/
slower. and if it is possible in first place.

--
GJ

"If we knew what we were doing, it wouldn't be called Research, would
it?" - AE




---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:37 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com