Re: atoi-like function: is there a better way to do this?

Поиск
Список
Период
Сортировка
От Chris Angelico
Тема Re: atoi-like function: is there a better way to do this?
Дата
Msg-id CAPTjJmp1WUdaVD5G+_sjzshXcH7Fc7RE85GKi7UXPaij80aFgw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: atoi-like function: is there a better way to do this?  (David Johnston <polobo@yahoo.com>)
Ответы Re: atoi-like function: is there a better way to do this?  (Tom Molesworth <tom@audioboundary.com>)
Список pgsql-general
On Mon, Mar 5, 2012 at 2:50 PM, David Johnston <polobo@yahoo.com> wrote:
> Any efficient, non-RegEx, alternative would require more context to evaluate than you provide.  Mainly, would it be
fasterto have a separate field to store the parsed (at input) number and then query that field directly (even if it is
atext field as well)?  Basically cache the parse. 

Caching's looking tempting, but I don't know if it'll be worth it
(these fields won't be searched-as-int very often compared to
search-as-string, and there's potentially a lot of such fields). All I
need out of it is the leading digits - I can strip them with trim(),
but I can't keep _only_ those digits.

The other possibility that may be of value is to write the function in
C instead of pl/pgsql, which will then actually call atoi() itself. Is
that going to be a better option?

ChrisA

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

Предыдущее
От: David Johnston
Дата:
Сообщение: Re: atoi-like function: is there a better way to do this?
Следующее
От: Tom Molesworth
Дата:
Сообщение: Re: atoi-like function: is there a better way to do this?