Re: How to add locale support for each column?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: How to add locale support for each column?
Дата
Msg-id 20788.1095621873@sss.pgh.pa.us
обсуждение исходный текст
Ответ на How to add locale support for each column?  (Mahmoud Taghizadeh <m_taghi@yahoo.com>)
Список pgsql-hackers
Greg Stark <gsstark@mit.edu> writes:
> I don't see how this is relevant though. One way or another postgres is going
> to have to sort strings in varying locales chosen at run-time. Comparing
> against strcoll's execution time without changing changing locales is a straw
> man.

No, it's not, because if we were to do our own implementation we could
avoid the need to do setlocale per se at all (inside the loop that is).
The trick is to expose the different locales as objects (pointed-to
structs) that can be passed to the strcoll function.  The fundamental
difficulty is not so much with the libc innards as with the lousy API.

> I see no reason to think Postgres's implementation of looking up xfrm rules
> for the specified locale will be any faster than the OS's.

The point is that we can move that lookup out of the inner loop.

> An order of magnitude change in the cost for strcoll isn't really relevant
> unless the cost for strcoll is significant to begin with. I suspect strcoll
> costs are currently dwarfed by the palloc costs to evaluate the expression
> already.

I don't have numbers for that at my fingertips, but I have measured it
in the past, and the comparison function *is* a significant part of the
total CPU cost in sorts.
        regards, tom lane


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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: How to add locale support for each column?
Следующее
От: Dennis Bjorklund
Дата:
Сообщение: Re: How to add locale support for each column?