| From: | "F(dot) BROUARD / SQLpro" <sqlpro(at)club-internet(dot)fr> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: Natural sort order |
| Date: | 2012-03-01 17:23:18 |
| Message-ID: | 4F4FB086.3080002@club-internet.fr |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
The fastest way is to create a ref table with all possible entries,
ordered with an additionnal numerical column, indexing it and make a
join from your table to this ref table.
A +
Le 17/12/2011 11:33, Richard Klingler a écrit :
> Morning...
>
> What is the fastest way to achieve natural ordering from queries?
>
> I found a function at:
> http://2kan.tumblr.com/post/361326656/postgres-natural-ordering
>
> But it increases the query time from around 0.4msecs to 74msecs...
> Might be not much if occasional queries are made..but I use it for
> building
> up a hierarchical tree menu in a web application where every msecs
> counts (o;
>
>
> cheers
> richard
>
>
--
Frédéric BROUARD - expert SGBDR et SQL - MVP SQL Server - 06 11 86 40 66
Le site sur le langage SQL et les SGBDR : http://sqlpro.developpez.com
Enseignant Arts & Métiers PACA, ISEN Toulon et CESI/EXIA Aix en Provence
Audit, conseil, expertise, formation, modélisation, tuning, optimisation
*********************** http://www.sqlspot.com *************************
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Adrian Klaver | 2012-03-01 18:36:17 | Re: Change Ownership Recursively |
| Previous Message | Carlos Mennens | 2012-03-01 17:04:17 | Re: Change Ownership Recursively |