sort array optimisation in pl/perl - Mailing list pgsql-general

From GIROIRE Nicolas (COFRAMI)
Subject sort array optimisation in pl/perl
Date
Msg-id 1904E3EB39448246A7ECB76DF34A70B0036A4002@TOCOMEXC03
Whole thread Raw
Responses Re: sort array optimisation in pl/perl  (Ragnar Hafstað <gnari@simnet.is>)
List pgsql-general

Hi,

I create an array which is result of query on postgresql database and then I want to sort rows in a particular way (impossible by query on database).

My solution consists to put a rows (indice m+1) in a temporary other and then move all element before indice n to m in rows with indice n+1 to m+1 and last i put my temporary variable to indice n.

I want to know if somebody know a better solution.

I think of 2 solutions but i don't success to apply :
  - the first is to use list in which I could deplace references as a chained list
  - the second will be to deplace tab[n..m] to tab[n+1..m+1] in one instruction as ada language

Is one of this solution exists and is better than my first ? If yes, can you help me to implement ?

Best regards,

Nicolas

pgsql-general by date:

Previous
From: Dan Sugalski
Date:
Subject: Re: plperl doesn't release memory
Next
From: Tom Lane
Date:
Subject: Re: plperl doesn't release memory