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
Actually got it figured...for some reason it had the function twice (o;
But with or without function index the time to query stays the same...around
110msec for 24 results...
cheers
richard
On Wed, 29 Feb 2012 11:08:46 -0500, Tom Lane wrote:
> Richard Klingler writes:
>> Took some time until
Richard Klingler writes:
> Took some time until I could try out this...
> But as soon I want to create the fcuntion based index it tells me:
> Error : ERROR: functions in index expression must be marked IMMUTABLE
FWIW, this example works fine for me. Maybe you have some weird
user-defined
Took some time until I could try out this...
But as soon I want to create the fcuntion based index it tells me:
Error : ERROR: functions in index expression must be marked IMMUTABLE
Deleteing the sort function and recreating with the IMMUTABLE attribute gives
the same error..
Here the
If you use btrsort(column) from the example, you can just create a
functional index on this expression.
CREATE INDEX mytable_column_btrsort_idx ON mytable( btrsort(column) );
this can help.
2011/12/17 Richard Klingler :
> Morning...
>
> What is the fastest way to achieve natural ordering fro
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 f