Re: Function args: TEXT -vs- VARCHAR?

Поиск
Список
Период
Сортировка
От skinner@britvault.co.uk (Craig R. Skinner)
Тема Re: Function args: TEXT -vs- VARCHAR?
Дата
Msg-id 20131113130308.GA17439@teak.britvault.co.uk
обсуждение исходный текст
Ответ на Re: Function args: TEXT -vs- VARCHAR?  (Luca Vernini <lucazeo@gmail.com>)
Ответы Re: Function args: TEXT -vs- VARCHAR?  (skinner@britvault.co.uk (Craig R. Skinner))
Список pgsql-sql
On 2013-11-12 Tue 19:23 PM |, Luca Vernini wrote:
> I like to have constraint, so I usually use character varying.

Same here, I have no text columns. All strings are stored as character
varying.

> Anyway, there is no performance difference:
> http://www.postgresql.org/docs/9.2/static/datatype-character.html
> 

Interesting, although that performance tip is about table storage, not
casting arguments from text to character varying within a function.

> So use character varying just if you can, or if you must limit the input.
> 

Yes, I'll change the function args to be the same as the table columns
so the functions fail on over length input, rather than going through
the process of validating customer id & account, only to fail on data.

Therefore => performace increase with character varying function args.

Thanks,
-- 
Craig Skinner | http://twitter.com/Craig_Skinner | http://linkd.in/yGqkv7



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

Предыдущее
От: Sergey Konoplev
Дата:
Сообщение: Re: Function args: TEXT -vs- VARCHAR?
Следующее
От: skinner@britvault.co.uk (Craig R. Skinner)
Дата:
Сообщение: Re: Function args: TEXT -vs- VARCHAR?