Re: Number of occurrence of characters?

Поиск
Список
Период
Сортировка
От Ivan Voras
Тема Re: Number of occurrence of characters?
Дата
Msg-id gmh0me$3of$1@ger.gmane.org
обсуждение исходный текст
Ответ на Re: Number of occurrence of characters?  (hubert depesz lubaczewski <depesz@depesz.com>)
Список pgsql-performance
hubert depesz lubaczewski wrote:
> On Thu, Feb 05, 2009 at 02:31:24PM +0100, Ivan Voras wrote:
>> The problem is how to do it efficiently. I see there isn't a built-in
>> function that counts character occurrences so I'd have to write it
>> myself. An additional constraint is that it must be implemented with
>> built-in capabilities, i.e. SQL and plpsql languages. I can do it the
>> brute force way, looping over the string and processing one by one
>> character with substring(), but is there a faster way?
>
> # select length(regexp_replace('/some/string/with/slashes', '[^/]+', '', 'g'));
>  length
> --------
>       4
> (1 row)

Thank you (and Heikki), I had a feeling I was missing an approach.


Вложения

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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: suggestions for postgresql setup on Dell 2950 , PERC6i controller
Следующее
От: Rohan Pethkar
Дата:
Сообщение: Can't locate Test/Parser/Dbt2.pm in DBT2 tests