Is array_append O(n)?

Поиск
Список
Период
Сортировка
От Rob Nikander
Тема Is array_append O(n)?
Дата
Msg-id D8BF133C-3C50-4A1C-B7F7-E5F27A776673@gmail.com
обсуждение исходный текст
Ответы Re: Is array_append O(n)?  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-general
Hi,

Does `array_append(arr, elt)` create a new array and copy everything? In other words, is it O(n) or O(1)? I’m trying to
useplpgsql and realizing I don’t really have my usual data structures for basic algorithms the way I’d normally write
them.I probably shouldn’t be treating arrays like Java ArrayList or C++ vector, where you can add/remove on the end
withlittle cost (O(1), almost.) 

Rob


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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: perf tuning for 28 cores and 252GB RAM
Следующее
От: Miles Elam
Дата:
Сообщение: Re: Inserts restricted to a trigger