Re: OCTET_LENGTH is wrong

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: OCTET_LENGTH is wrong
Дата
Msg-id 22148.1006022771@sss.pgh.pa.us
обсуждение исходный текст
Ответ на OCTET_LENGTH is wrong  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: OCTET_LENGTH is wrong  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: OCTET_LENGTH is wrong  (Tatsuo Ishii <t-ishii@sra.co.jp>)
Список pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> I noticed OCTET_LENGTH will return the size of the data after TOAST may
> have compressed it.  While this could be useful information, this
> behaviour has no basis in the SQL standard and it's not what is
> documented.  Moreover, it eliminates the standard useful behaviour of
> OCTET_LENGTH, which is to show the length in bytes of a multibyte string.

I wondered about that too, the first time I noticed it.  On the other
hand, knowing the compressed length is kinda useful too, at least for
hacking and DBA purposes.  (One might also like to know whether a value
has been moved out of line, which is not currently determinable.)

I don't want to force an initdb at this stage, at least not without
compelling reason, so adding more functions right now is not feasible.
Maybe a TODO item for next time.

That leaves us with the question whether to change OCTET_LENGTH now
or leave it for later.  Anyone?

BTW, I noticed that textlength() is absolutely unreasonably slow when
MULTIBYTE is enabled --- yesterday I was trying to profile TOAST
overhead, and soon discovered that what I was looking at was nothing
but pg_mblen() calls.  It really needs a short-circuit path for
single-byte encodings.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Multilingual application, ORDER BY w/ different locales?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: beta3