Aggregate C function accumulating a text array

Поиск
Список
Период
Сортировка
От Joel Dudley
Тема Aggregate C function accumulating a text array
Дата
Msg-id 40C103E3.8050303@nanovoid.com
обсуждение исходный текст
Ответы Re: Aggregate C function accumulating a text array  (Joe Conway <mail@joeconway.com>)
Список pgsql-general
Hello,
   I am about to write a set of C functions to be used in an aggregate
function in which the final function performs a calculation on an array
of accumulated text data types stored in a text[] array. I need to use
the text type because this function will be used on DNA sequences which
can be very large. My questions are the following. What is the most
efficient way to accumulate a text array while being efficient with
memory? I see construct_array() used in accumulation functions but I am
worried that I might end up making a copy of a potentially very large
text array each time my accumulation function is called.

The general flow is

User defined aggregate function
    SELECT pb_distance_k2p(sequence) WHERE family_id = 10;

uses accumulation function

distance_accum(PG_FUNCTION_ARGS);

and uses a final function

calculate_distance_k2p(PG_FUNCTION_ARGS)

which needs to deconstruct_array() to get the text array and loop
through the array to do some pairwise comparisons of the text and return
a multidimensional array

Am I thinking about this correctly? Are there any potential pitfalls in
the proposed strategy? I greatly appreciate your feedback.

- Joel

В списке pgsql-general по дате отправления:

Предыдущее
От: "Chris Ochs"
Дата:
Сообщение: Re: dynamic function question
Следующее
От: Bill Moran
Дата:
Сообщение: Re: Queries slow from within plpgsql