Re: Sorting Problem

Lists: pgsql-general
From: "Maksim Likharev" <mlikharev(at)aurigin(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Sorting Problem
Date: 2003-08-12 23:54:32
Message-ID: 56510AAEF435D240958D1CE8C6B1770A016D2DEB@mailc03.aurigin.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

If you are talking about everything that lies under so called LATIN-1 (
ISO-8859-1 )
en_US encapsulates ( at least suppose to ) all those sorting rules,
do not remember about accents tho.

-----Original Message-----
From: Kathy zhu [mailto:Kathy(dot)zhu(at)Sun(dot)COM]
Sent: Tuesday, August 12, 2003 4:43 PM
To: gearond(at)cvc(dot)net
Cc: Tom Lane; Tim Edwards; pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Sorting Problem

This brings up another question:

Say initdb with en_US locale, and we have localized strings for
different
languages store in the db.

If we have a client in Germany, and want to see the text sorted in
german. I
mean that we want do db soring for german strings and display the result
in the
browser. How are we going to handle that ??

thanks,
kathy

Dennis Gearon wrote:
> Danke, Spacibo, gracias, thanks.
>
> Tom Lane wrote:
>
>> Dennis Gearon <gearond(at)cvc(dot)net> writes:
>>
>>> You mean in his own local environment? So all his programs, console
>>> operations, etc, will have the new encoding? Or 'LANG/LC_ALL' for
>>> Posgres specifically?
>>
>>
>>
>> I mean he needs to run initdb with C as the selected locale. It has
>> nothing to do with what environment his other programs run in.
>>
>> regards, tom lane
>>
>
>
> ---------------------------(end of
broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings

--

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


From: Kathy <kathy(dot)zhu(at)sun(dot)com>
To: Maksim Likharev <mlikharev(at)aurigin(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-13 05:06:56
Message-ID: 3F39C770.5050204@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Does including sorting rules for asian chars too ??
Do you know where I can find docuemt on this subject ??
thanks,
kathy

Maksim Likharev wrote:

>If you are talking about everything that lies under so called LATIN-1 (
>ISO-8859-1 )
>en_US encapsulates ( at least suppose to ) all those sorting rules,
>do not remember about accents tho.
>
>
>-----Original Message-----
>From: Kathy zhu [mailto:Kathy(dot)zhu(at)Sun(dot)COM]
>Sent: Tuesday, August 12, 2003 4:43 PM
>To: gearond(at)cvc(dot)net
>Cc: Tom Lane; Tim Edwards; pgsql-general(at)postgresql(dot)org
>Subject: Re: [GENERAL] Sorting Problem
>
>
>This brings up another question:
>
>Say initdb with en_US locale, and we have localized strings for
>different
>languages store in the db.
>
>If we have a client in Germany, and want to see the text sorted in
>german. I
>mean that we want do db soring for german strings and display the result
>in the
>browser. How are we going to handle that ??
>
>thanks,
>kathy
>
>
>
>
>Dennis Gearon wrote:
>
>
>>Danke, Spacibo, gracias, thanks.
>>
>>Tom Lane wrote:
>>
>>
>>
>>>Dennis Gearon <gearond(at)cvc(dot)net> writes:
>>>
>>>
>>>
>>>>You mean in his own local environment? So all his programs, console
>>>>operations, etc, will have the new encoding? Or 'LANG/LC_ALL' for
>>>>Posgres specifically?
>>>>
>>>>
>>>
>>>I mean he needs to run initdb with C as the selected locale. It has
>>>nothing to do with what environment his other programs run in.
>>>
>>> regards, tom lane
>>>
>>>
>>>
>>---------------------------(end of
>>
>>
>broadcast)---------------------------
>
>
>>TIP 7: don't forget to increase your free space map settings
>>
>>
>
>
>
>


From: Dennis Björklund <db(at)zigo(dot)dhs(dot)org>
To: Maksim Likharev <mlikharev(at)aurigin(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-13 09:00:20
Message-ID: Pine.LNX.4.44.0308131045390.2191-100000@zigo.dhs.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Tue, 12 Aug 2003, Maksim Likharev wrote:

> If you are talking about everything that lies under so called LATIN-1 (
> ISO-8859-1 ) en_US encapsulates ( at least suppose to ) all those
> sorting rules, do not remember about accents tho.

It does not work like that. Different countries in europe that all use
latin1 use different sort order for the same characters. There is no way
to have one set of rules work for all. If we take swedish for example,
then v and w is treatead as the same letter when sorting. So in a
dictionary all words beginning with v or w is mixed together.

In the future we need indexes that depend on the locale (and a lot of
other changes).

--
/Dennis


From: Dennis Gearon <gearond(at)cvc(dot)net>
To: Dennis Björklund <db(at)zigo(dot)dhs(dot)org>
Cc: Maksim Likharev <mlikharev(at)aurigin(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-13 16:09:00
Message-ID: 3F3A629C.5090307@cvc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Dennis Björklund wrote:

> In the future we need indexes that depend on the locale (and a lot of other changes).
>

I agree. I've been looking at the web on this subject a lot lately. I am **NOT** a microslop fan, but SQL-SERVER even lets a user define a language(maybe encoding) down to the column level!

I've been reading on GNU-C and on languages, encoding, and localization.

http://pauillac.inria.fr/~lang/hotlist/free/licence/fsf96/drepper/paper-1.html
http://h21007.www2.hp.com/dspp/tech/tech_TechSingleTipDetailPage_IDX/1,2366,1222,00.html

There are three basic approaches to doing different langauges in computerized text:

A/ various adaptations of the 8 bit character set, I.E. the ISO-8859-x series.
One byte per character.
Easy storing, small size for a string.
Easy storing, if english characters, 100% efficient use of storage space.
Easy processing between applications, works well in the stream model of *nix
Easy processing in applications, a byte is a character.
Easy string handling, NOY NULL bytes in a string, except end of string.
NOT easy to know encoding from inherently in the document.
This is not the way of the future.

B/ wide characters
UTF16, UTF32, SHIFT-JIS-16, others
each character the same width, 2 or 4 bytes (2 bytes handles 99% of all languages)
Not so easy storing, if english characters, 50% to 75% loss of storage space.
Difficult processing between applications, does NOT work well in the stream model of *nix
Easy processing in applications, a set width of bits/bytes is a character.
Difficult string handling, MANY NULL bytes in a string, especially if in English.
Moderately easy to tell encoding/language in the document.
********This should be how Postgress stores data internally.********

C/ Multibyte characters
UTF8
variable width for different characters 1-5
Not so easy storing, if non english characters, 50% to 80% loss of storage space,
(in reality, most common western languages hover aournd 5-20% loss of storage space
most common non western languages hover aournd 40-60%% loss of storage space)
Easy processing between applications, works well in the stream model of *nix
Difficult processing in applications, a variable number of bytes is a character.
Easy string string handling, ONE NULL byte in a string.
Moderately easy to tell encoding/language in the document.
********This is how Postgress should default to sending data OUT of the application,
i.e. to the display or the web, or other system applications********

>


From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Dennis Gearon <gearond(at)cvc(dot)net>
Cc: Dennis Björklund <db(at)zigo(dot)dhs(dot)org>, Maksim Likharev <mlikharev(at)aurigin(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Sorting Problem
Date: 2003-08-13 16:31:31
Message-ID: 20030813091339.J50295-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


On Wed, 13 Aug 2003, Dennis Gearon wrote:

> Dennis Bjrklund wrote:
>
> > In the future we need indexes that depend on the locale (and a lot of other changes).
> >
>
> I agree. I've been looking at the web on this subject a lot lately. I
> am **NOT** a microslop fan, but SQL-SERVER even lets a user define a
> language(maybe encoding) down to the column level!
>
> I've been reading on GNU-C and on languages, encoding, and localization.
>
> http://pauillac.inria.fr/~lang/hotlist/free/licence/fsf96/drepper/paper-1.html
> http://h21007.www2.hp.com/dspp/tech/tech_TechSingleTipDetailPage_IDX/1,2366,1222,00.html
>
>
> There are three basic approaches to doing different langauges in computerized text:
>
> A/ various adaptations of the 8 bit character set, I.E. the ISO-8859-x series.
> B/ wide characters
> ********This should be how Postgress stores data internally.********
> C/ Multibyte characters
> ********This is how Postgress should default to sending data OUT of the application,
> i.e. to the display or the web, or other system applications********

SQL has a system for defining character set specifications, collations and
such (per column/literal in some cases). We should probably look at it
before making decisions on how to do things.


From: Dennis Gearon <gearond(at)cvc(dot)net>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: Dennis Björklund <db(at)zigo(dot)dhs(dot)org>, Maksim Likharev <mlikharev(at)aurigin(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-13 16:51:58
Message-ID: 3F3A6CAE.6050207@cvc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Got a link to that section of the standard, or better yet, to a 'interpreted' version of the standard? :-)

Stephan Szabo wrote:

> On Wed, 13 Aug 2003, Dennis Gearon wrote:
>
>
>>Dennis Bj?rklund wrote:
>>
>>
>>>In the future we need indexes that depend on the locale (and a lot of other changes).
>>>
>>
>>I agree. I've been looking at the web on this subject a lot lately. I
>>am **NOT** a microslop fan, but SQL-SERVER even lets a user define a
>>language(maybe encoding) down to the column level!
>>
>>I've been reading on GNU-C and on languages, encoding, and localization.
>>
>>http://pauillac.inria.fr/~lang/hotlist/free/licence/fsf96/drepper/paper-1.html
>>http://h21007.www2.hp.com/dspp/tech/tech_TechSingleTipDetailPage_IDX/1,2366,1222,00.html
>>
>>
>>There are three basic approaches to doing different langauges in computerized text:
>>
>> A/ various adaptations of the 8 bit character set, I.E. the ISO-8859-x series.
>> B/ wide characters
>> ********This should be how Postgress stores data internally.********
>> C/ Multibyte characters
>> ********This is how Postgress should default to sending data OUT of the application,
>> i.e. to the display or the web, or other system applications********
>
>
> SQL has a system for defining character set specifications, collations and
> such (per column/literal in some cases). We should probably look at it
> before making decisions on how to do things.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>


From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Dennis Gearon <gearond(at)cvc(dot)net>
Cc: Dennis Björklund <db(at)zigo(dot)dhs(dot)org>, Maksim Likharev <mlikharev(at)aurigin(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Sorting Problem
Date: 2003-08-13 16:59:00
Message-ID: 20030813095010.B51490-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


On Wed, 13 Aug 2003, Dennis Gearon wrote:

> Got a link to that section of the standard, or better yet, to a
> 'interpreted' version of the standard? :-)

The standard draft yes, an interpreted version, unfortunately not (unless
Date's book covers it and I can find where my copy is.

Here are some of the highlights

----
k) form-of-use: A convention (or encoding) for representing
characters (in character strings). Some forms-of-use are
fixed-length codings and others are variable-length codings.

l) form-of-use conversion: A method of converting character
strings from one form-of-use to another form-of-use.

----
A character set is described by a character set descriptor. A
character set descriptor includes:

- the name of the character set or character repertoire,

- if the character set is a character repertoire, then the name of
the form-of-use,

- an indication of what characters are in the character set, and

- the name of the default collation of the character set.

For every character set, there is at least one collation. A
collation is described by a collation descriptor. A collation descriptor
includes:

- the name of the collation,

- the name of the character set on which the collation operates,

- whether the collation has the NO PAD or the PAD SPACE attribute,
and

- an indication of how the collation is performed.

---

The character data types and literals can include a character set
definition. Character type columns can include a collation. There's a
COLLATE <blah> clause that looks like it can be used in expressions as
well.


From: Gianni Mariani <gianni(at)mariani(dot)ws>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-13 17:30:43
Message-ID: 3F3A75C3.3060006@mariani.ws
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Dennis Gearon wrote:

> Got a link to that section of the standard, or better yet, to a
> 'interpreted' version of the standard? :-)
>
> Stephan Szabo wrote:
>
>> On Wed, 13 Aug 2003, Dennis Gearon wrote:
>>
>>
>>> Dennis Bj?rklund wrote:
>>>
>>>
>>>> In the future we need indexes that depend on the locale (and a lot
>>>> of other changes).
>>>>
>>>
>>> I agree. I've been looking at the web on this subject a lot lately. I
>>> am **NOT** a microslop fan, but SQL-SERVER even lets a user define a
>>> language(maybe encoding) down to the column level!
>>>
>>> I've been reading on GNU-C and on languages, encoding, and
>>> localization.
>>>
>>> http://pauillac.inria.fr/~lang/hotlist/free/licence/fsf96/drepper/paper-1.html
>>>
>>> http://h21007.www2.hp.com/dspp/tech/tech_TechSingleTipDetailPage_IDX/1,2366,1222,00.html
>>>
>>>
>>>
>>> There are three basic approaches to doing different langauges in
>>> computerized text:
>>>
>>> A/ various adaptations of the 8 bit character set, I.E. the
>>> ISO-8859-x series.
>>> B/ wide characters
>>> ********This should be how Postgress stores data internally.********
>>> C/ Multibyte characters
>>> ********This is how Postgress should default to sending data OUT
>>> of the application,
>>> i.e. to the display or the web, or other system
>>> applications********
>>
>>
>>
>> SQL has a system for defining character set specifications,
>> collations and
>> such (per column/literal in some cases). We should probably look at it
>> before making decisions on how to do things.
>

I thought UNIX (SCOTM) systems also had a way of being able to define
collation order.

see:
ftp://dkuug.dk/i18n/WG15-collection/locales

for a collection of all ISO standardized locales (the WG15 ISO work
group's stuff).

Do a "man localedef" on most Linuxen or UNIXen.

As for wide characters vs multibyte, there is no clear winner. The
right answer DEPENDS on the situation.

Wide characters on some platforms are 16 bit which means that when you
do Unicode you'll still have problems with surrogate pairs (meaning that
it's still multi (wide) char) so you still have all the problems of
multi-byte encodings.

You could decide to process everything in a PG specific 4 byte wide char
and do all text in Unicode but the overhead in processing 4 times the
data is quite significant. The other option is to store all data in
utf-8 and have all text code become utf-8 aware.

I have found in practice that the utf-8 option is significantly easier
to implement, 100% Unicode compliant and the best performer (because of
reduced memory requirements).

The Posix API's for locales are not very good for modern day programs,
I'm not sure where the "mbr*" and the "wcr*" apis are in the
standardization process but if these are not well supported, you're on
your own and will need to implement similar functionality from scratch
and for that matter, the collation functions all operate on a "current"
locate which is really difficult to work with on multi-locale applications.


From: Dennis Gearon <gearond(at)cvc(dot)net>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: Dennis Björklund <db(at)zigo(dot)dhs(dot)org>, Maksim Likharev <mlikharev(at)aurigin(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-13 17:30:52
Message-ID: 3F3A75CC.5080007@cvc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

If we really want to do it, we won't have to do the grunt work ourselves, just the tie-in, and Postgres specific implementation:

http://www.unicode.org/reports/tr10/

Stephan Szabo wrote:

> On Wed, 13 Aug 2003, Dennis Gearon wrote:
>
>
>>Got a link to that section of the standard, or better yet, to a
>>'interpreted' version of the standard? :-)
>
>
> The standard draft yes, an interpreted version, unfortunately not (unless
> Date's book covers it and I can find where my copy is.
>
> Here are some of the highlights
>
> ----
> k) form-of-use: A convention (or encoding) for representing
> characters (in character strings). Some forms-of-use are
> fixed-length codings and others are variable-length codings.
>
> l) form-of-use conversion: A method of converting character
> strings from one form-of-use to another form-of-use.
>
> ----
> A character set is described by a character set descriptor. A
> character set descriptor includes:
>
> - the name of the character set or character repertoire,
>
> - if the character set is a character repertoire, then the name of
> the form-of-use,
>
> - an indication of what characters are in the character set, and
>
> - the name of the default collation of the character set.
>
> For every character set, there is at least one collation. A
> collation is described by a collation descriptor. A collation descriptor
> includes:
>
> - the name of the collation,
>
> - the name of the character set on which the collation operates,
>
> - whether the collation has the NO PAD or the PAD SPACE attribute,
> and
>
> - an indication of how the collation is performed.
>
> ---
>
> The character data types and literals can include a character set
> definition. Character type columns can include a collation. There's a
> COLLATE <blah> clause that looks like it can be used in expressions as
> well.
>
>


From: Dennis Gearon <gearond(at)cvc(dot)net>
To: Gianni Mariani <gianni(at)mariani(dot)ws>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-13 18:04:16
Message-ID: 3F3A7DA0.5060301@cvc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

I agree with all of that except for one caveat:

all my reading, and just general off the cuff thinking, says that processing variable width characters SIGNIFICANTLY slows an application. It seems better to PROCESS fixed width characters (1,2,4 byte), and TRANSMIT variable width characters (avoiding the null problem.)

Gianni Mariani wrote:

> Dennis Gearon wrote:
>
>> Got a link to that section of the standard, or better yet, to a
>> 'interpreted' version of the standard? :-)
>>
>> Stephan Szabo wrote:
>>
>>> On Wed, 13 Aug 2003, Dennis Gearon wrote:
>>>
>>>
>>>> Dennis Bj?rklund wrote:
>>>>
>>>>
>>>>> In the future we need indexes that depend on the locale (and a lot
>>>>> of other changes).
>>>>>
>>>>
>>>> I agree. I've been looking at the web on this subject a lot lately. I
>>>> am **NOT** a microslop fan, but SQL-SERVER even lets a user define a
>>>> language(maybe encoding) down to the column level!
>>>>
>>>> I've been reading on GNU-C and on languages, encoding, and
>>>> localization.
>>>>
>>>> http://pauillac.inria.fr/~lang/hotlist/free/licence/fsf96/drepper/paper-1.html
>>>>
>>>> http://h21007.www2.hp.com/dspp/tech/tech_TechSingleTipDetailPage_IDX/1,2366,1222,00.html
>>>>
>>>>
>>>>
>>>> There are three basic approaches to doing different langauges in
>>>> computerized text:
>>>>
>>>> A/ various adaptations of the 8 bit character set, I.E. the
>>>> ISO-8859-x series.
>>>> B/ wide characters
>>>> ********This should be how Postgress stores data internally.********
>>>> C/ Multibyte characters
>>>> ********This is how Postgress should default to sending data OUT
>>>> of the application,
>>>> i.e. to the display or the web, or other system
>>>> applications********
>>>
>>>
>>>
>>>
>>> SQL has a system for defining character set specifications,
>>> collations and
>>> such (per column/literal in some cases). We should probably look at it
>>> before making decisions on how to do things.
>>
>>
>
> I thought UNIX (SCOTM) systems also had a way of being able to define
> collation order.
>
> see:
> ftp://dkuug.dk/i18n/WG15-collection/locales
>
> for a collection of all ISO standardized locales (the WG15 ISO work
> group's stuff).
>
> Do a "man localedef" on most Linuxen or UNIXen.
>
> As for wide characters vs multibyte, there is no clear winner. The
> right answer DEPENDS on the situation.
>
> Wide characters on some platforms are 16 bit which means that when you
> do Unicode you'll still have problems with surrogate pairs (meaning that
> it's still multi (wide) char) so you still have all the problems of
> multi-byte encodings.
>
> You could decide to process everything in a PG specific 4 byte wide char
> and do all text in Unicode but the overhead in processing 4 times the
> data is quite significant. The other option is to store all data in
> utf-8 and have all text code become utf-8 aware.
>
> I have found in practice that the utf-8 option is significantly easier
> to implement, 100% Unicode compliant and the best performer (because of
> reduced memory requirements).
> The Posix API's for locales are not very good for modern day programs,
> I'm not sure where the "mbr*" and the "wcr*" apis are in the
> standardization process but if these are not well supported, you're on
> your own and will need to implement similar functionality from scratch
> and for that matter, the collation functions all operate on a "current"
> locate which is really difficult to work with on multi-locale applications.
>
>
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: gearond(at)cvc(dot)net
Cc: Gianni Mariani <gianni(at)mariani(dot)ws>, pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-13 18:13:21
Message-ID: 200308131813.h7DIDL608484@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


I think the question is how often are you passing data around/storing it
_in_ your application and how often are you processing it.

---------------------------------------------------------------------------

Dennis Gearon wrote:
> I agree with all of that except for one caveat:
>
> all my reading, and just general off the cuff thinking, says that processing variable width characters SIGNIFICANTLY slows an application. It seems better to PROCESS fixed width characters (1,2,4 byte), and TRANSMIT variable width characters (avoiding the null problem.)
>
> Gianni Mariani wrote:
>
> > Dennis Gearon wrote:
> >
> >> Got a link to that section of the standard, or better yet, to a
> >> 'interpreted' version of the standard? :-)
> >>
> >> Stephan Szabo wrote:
> >>
> >>> On Wed, 13 Aug 2003, Dennis Gearon wrote:
> >>>
> >>>
> >>>> Dennis Bj?rklund wrote:
> >>>>
> >>>>
> >>>>> In the future we need indexes that depend on the locale (and a lot
> >>>>> of other changes).
> >>>>>
> >>>>
> >>>> I agree. I've been looking at the web on this subject a lot lately. I
> >>>> am **NOT** a microslop fan, but SQL-SERVER even lets a user define a
> >>>> language(maybe encoding) down to the column level!
> >>>>
> >>>> I've been reading on GNU-C and on languages, encoding, and
> >>>> localization.
> >>>>
> >>>> http://pauillac.inria.fr/~lang/hotlist/free/licence/fsf96/drepper/paper-1.html
> >>>>
> >>>> http://h21007.www2.hp.com/dspp/tech/tech_TechSingleTipDetailPage_IDX/1,2366,1222,00.html
> >>>>
> >>>>
> >>>>
> >>>> There are three basic approaches to doing different langauges in
> >>>> computerized text:
> >>>>
> >>>> A/ various adaptations of the 8 bit character set, I.E. the
> >>>> ISO-8859-x series.
> >>>> B/ wide characters
> >>>> ********This should be how Postgress stores data internally.********
> >>>> C/ Multibyte characters
> >>>> ********This is how Postgress should default to sending data OUT
> >>>> of the application,
> >>>> i.e. to the display or the web, or other system
> >>>> applications********
> >>>
> >>>
> >>>
> >>>
> >>> SQL has a system for defining character set specifications,
> >>> collations and
> >>> such (per column/literal in some cases). We should probably look at it
> >>> before making decisions on how to do things.
> >>
> >>
> >
> > I thought UNIX (SCOTM) systems also had a way of being able to define
> > collation order.
> >
> > see:
> > ftp://dkuug.dk/i18n/WG15-collection/locales
> >
> > for a collection of all ISO standardized locales (the WG15 ISO work
> > group's stuff).
> >
> > Do a "man localedef" on most Linuxen or UNIXen.
> >
> > As for wide characters vs multibyte, there is no clear winner. The
> > right answer DEPENDS on the situation.
> >
> > Wide characters on some platforms are 16 bit which means that when you
> > do Unicode you'll still have problems with surrogate pairs (meaning that
> > it's still multi (wide) char) so you still have all the problems of
> > multi-byte encodings.
> >
> > You could decide to process everything in a PG specific 4 byte wide char
> > and do all text in Unicode but the overhead in processing 4 times the
> > data is quite significant. The other option is to store all data in
> > utf-8 and have all text code become utf-8 aware.
> >
> > I have found in practice that the utf-8 option is significantly easier
> > to implement, 100% Unicode compliant and the best performer (because of
> > reduced memory requirements).
> > The Posix API's for locales are not very good for modern day programs,
> > I'm not sure where the "mbr*" and the "wcr*" apis are in the
> > standardization process but if these are not well supported, you're on
> > your own and will need to implement similar functionality from scratch
> > and for that matter, the collation functions all operate on a "current"
> > locate which is really difficult to work with on multi-locale applications.
> >
> >
> >
> >
> >
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 8: explain analyze is your friend
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Gianni Mariani <gianni(at)mariani(dot)ws>
To: gearond(at)cvc(dot)net
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-13 18:15:03
Message-ID: 3F3A8027.6080905@mariani.ws
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Dennis Gearon wrote:

> I agree with all of that except for one caveat:
>
> all my reading, and just general off the cuff thinking, says that
> processing variable width characters SIGNIFICANTLY slows an
> application. It seems better to PROCESS fixed width characters (1,2,4
> byte), and TRANSMIT variable width characters (avoiding the null
> problem.)

I can and have solved that problem. If you can assume utf-8 encoding
then there are available to you a bunch o tricks that takes this problem
away.

The other problem with memory (and hence cache) utilization of a wide
char only solution it far more significant.
Cache effects are the primary killer for performance in an app like a
database.

Anyhow, before making any "decisions" one should do a bunch of analysis.

Cheers
G


From: Dennis Gearon <gearond(at)cvc(dot)net>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Gianni Mariani <gianni(at)mariani(dot)ws>, pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-13 18:27:03
Message-ID: 3F3A82F7.6080303@cvc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

I agree, mostly. In the case of a database, I would bet that the INTERNAL, IN-APPLICATION processing FAAAAAAAAAAARRRRRRRRRRR exceeds that of sending and receiving it.

i.e. comparisons, sorts, triggers, indexes, views, functions, logging to tables, ordering by,
grouping, etc.

except backups, restores, logging to text files (these would be good in UTF8)

Bruce Momjian wrote:

> I think the question is how often are you passing data around/storing it
> _in_ your application and how often are you processing it.
>
> ---------------------------------------------------------------------------
>
> Dennis Gearon wrote:
>
>>I agree with all of that except for one caveat:
>>
>> all my reading, and just general off the cuff thinking, says that processing variable width characters SIGNIFICANTLY slows an application. It seems better to PROCESS fixed width characters (1,2,4 byte), and TRANSMIT variable width characters (avoiding the null problem.)
>>
>>Gianni Mariani wrote:
>>
>>
>>>Dennis Gearon wrote:
>>>
>>>
>>>>Got a link to that section of the standard, or better yet, to a
>>>>'interpreted' version of the standard? :-)
>>>>
>>>>Stephan Szabo wrote:
>>>>
>>>>
>>>>>On Wed, 13 Aug 2003, Dennis Gearon wrote:
>>>>>
>>>>>
>>>>>
>>>>>>Dennis Bj?rklund wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>In the future we need indexes that depend on the locale (and a lot
>>>>>>>of other changes).
>>>>>>>
>>>>>>
>>>>>>I agree. I've been looking at the web on this subject a lot lately. I
>>>>>>am **NOT** a microslop fan, but SQL-SERVER even lets a user define a
>>>>>>language(maybe encoding) down to the column level!
>>>>>>
>>>>>>I've been reading on GNU-C and on languages, encoding, and
>>>>>>localization.
>>>>>>
>>>>>>http://pauillac.inria.fr/~lang/hotlist/free/licence/fsf96/drepper/paper-1.html
>>>>>>
>>>>>>http://h21007.www2.hp.com/dspp/tech/tech_TechSingleTipDetailPage_IDX/1,2366,1222,00.html
>>>>>>
>>>>>>
>>>>>>
>>>>>>There are three basic approaches to doing different langauges in
>>>>>>computerized text:
>>>>>>
>>>>>> A/ various adaptations of the 8 bit character set, I.E. the
>>>>>>ISO-8859-x series.
>>>>>> B/ wide characters
>>>>>> ********This should be how Postgress stores data internally.********
>>>>>> C/ Multibyte characters
>>>>>> ********This is how Postgress should default to sending data OUT
>>>>>>of the application,
>>>>>> i.e. to the display or the web, or other system
>>>>>>applications********
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>SQL has a system for defining character set specifications,
>>>>>collations and
>>>>>such (per column/literal in some cases). We should probably look at it
>>>>>before making decisions on how to do things.
>>>>
>>>>
>>>I thought UNIX (SCOTM) systems also had a way of being able to define
>>>collation order.
>>>
>>>see:
>>> ftp://dkuug.dk/i18n/WG15-collection/locales
>>>
>>>for a collection of all ISO standardized locales (the WG15 ISO work
>>>group's stuff).
>>>
>>>Do a "man localedef" on most Linuxen or UNIXen.
>>>
>>>As for wide characters vs multibyte, there is no clear winner. The
>>>right answer DEPENDS on the situation.
>>>
>>>Wide characters on some platforms are 16 bit which means that when you
>>>do Unicode you'll still have problems with surrogate pairs (meaning that
>>>it's still multi (wide) char) so you still have all the problems of
>>>multi-byte encodings.
>>>
>>>You could decide to process everything in a PG specific 4 byte wide char
>>>and do all text in Unicode but the overhead in processing 4 times the
>>>data is quite significant. The other option is to store all data in
>>>utf-8 and have all text code become utf-8 aware.
>>>
>>>I have found in practice that the utf-8 option is significantly easier
>>>to implement, 100% Unicode compliant and the best performer (because of
>>>reduced memory requirements).
>>>The Posix API's for locales are not very good for modern day programs,
>>>I'm not sure where the "mbr*" and the "wcr*" apis are in the
>>>standardization process but if these are not well supported, you're on
>>>your own and will need to implement similar functionality from scratch
>>>and for that matter, the collation functions all operate on a "current"
>>>locate which is really difficult to work with on multi-locale applications.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>---------------------------(end of broadcast)---------------------------
>>>TIP 8: explain analyze is your friend
>>>
>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 7: don't forget to increase your free space map settings
>>
>
>


From: Dennis Gearon <gearond(at)cvc(dot)net>
To: Gianni Mariani <gianni(at)mariani(dot)ws>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-13 18:30:07
Message-ID: 3F3A83AF.10603@cvc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

How did you solve the problem .......... :-)

Gianni Mariani wrote:

> Dennis Gearon wrote:
>
>> I agree with all of that except for one caveat:
>>
>> all my reading, and just general off the cuff thinking, says that
>> processing variable width characters SIGNIFICANTLY slows an
>> application. It seems better to PROCESS fixed width characters (1,2,4
>> byte), and TRANSMIT variable width characters (avoiding the null
>> problem.)
>
>
>
> I can and have solved that problem. If you can assume utf-8 encoding
> then there are available to you a bunch o tricks that takes this problem
> away.
>
> The other problem with memory (and hence cache) utilization of a wide
> char only solution it far more significant.
> Cache effects are the primary killer for performance in an app like a
> database.
>
> Anyhow, before making any "decisions" one should do a bunch of analysis.
>
> Cheers
> G
>
>
>
>


From: Dennis Gearon <gearond(at)cvc(dot)net>
To: Gianni Mariani <gianni(at)mariani(dot)ws>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-13 18:33:31
Message-ID: 3F3A847B.5020007@cvc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Perhaps the only way to get around the cache problem is to use an ISO-8859-x 8bit character set, but to have per table, or per column encoding attributes. And of course, ways to access what those are, in the Postgres API. Good for speed, but not for easy storing of multiple language/encodings per column/table.

Gianni Mariani wrote:

> Dennis Gearon wrote:
>
>> I agree with all of that except for one caveat:
>>
>> all my reading, and just general off the cuff thinking, says that
>> processing variable width characters SIGNIFICANTLY slows an
>> application. It seems better to PROCESS fixed width characters (1,2,4
>> byte), and TRANSMIT variable width characters (avoiding the null
>> problem.)
>
>
>
> I can and have solved that problem. If you can assume utf-8 encoding
> then there are available to you a bunch o tricks that takes this problem
> away.
>
> The other problem with memory (and hence cache) utilization of a wide
> char only solution it far more significant.
> Cache effects are the primary killer for performance in an app like a
> database.
>
> Anyhow, before making any "decisions" one should do a bunch of analysis.
>
> Cheers
> G
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>


From: Gianni Mariani <gianni(at)mariani(dot)ws>
To: gearond(at)cvc(dot)net
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-13 18:54:46
Message-ID: 3F3A8976.8090109@mariani.ws
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Dennis Gearon wrote:

> How did you solve the problem .......... :-)

inlining - most chars are just ascii and there are trivial optimizations
that can lead to just as fast as moving 4x the data around.


From: Kathy zhu <Kathy(dot)zhu(at)Sun(dot)COM>
To: gearond(at)cvc(dot)net
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Gianni Mariani <gianni(at)mariani(dot)ws>, pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-13 21:12:39
Message-ID: 3F3AA9C7.8030202@Sun.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Ok, thanks for all the discussion followed, vey educational :-))
But nobody really followed up my question :-(

For example, you have a table that is displayed in the browser. You want to let
the user do sorting on one or multible columns, including those which contain
localized strings.

If the db supports sorting for multi-linguages, you can retreive all the rows
and do "ORDER BY" on the columns directly.

But if db doesn't support that, in Java, you will have to retrieve all the rows
first, sort the objects on multiple columnes listed in the "ORDER BY" in java.
It is much slower than the previous one.

My problem is that if initdb is done with en_US, if a customer in Japan request
the page with that sorted table, the text is not sorted in a Japanese one. Then
I have a problem.

Any suggestions on that ??

Dennis Gearon wrote:
> I agree, mostly. In the case of a database, I would bet that the
> INTERNAL, IN-APPLICATION processing FAAAAAAAAAAARRRRRRRRRRR exceeds that
> of sending and receiving it.
>
> i.e. comparisons, sorts, triggers, indexes, views, functions,
> logging to tables, ordering by,
> grouping, etc.
>
> except backups, restores, logging to text files (these would be good
> in UTF8)
>
> Bruce Momjian wrote:
>
>> I think the question is how often are you passing data around/storing it
>> _in_ your application and how often are you processing it.
>>
>> ---------------------------------------------------------------------------
>>
>>
>> Dennis Gearon wrote:
>>
>>> I agree with all of that except for one caveat:
>>>
>>> all my reading, and just general off the cuff thinking, says that
>>> processing variable width characters SIGNIFICANTLY slows an
>>> application. It seems better to PROCESS fixed width characters (1,2,4
>>> byte), and TRANSMIT variable width characters (avoiding the null
>>> problem.)
>>>
>>> Gianni Mariani wrote:
>>>
>>>
>>>> Dennis Gearon wrote:
>>>>
>>>>
>>>>> Got a link to that section of the standard, or better yet, to a
>>>>> 'interpreted' version of the standard? :-)
>>>>>
>>>>> Stephan Szabo wrote:
>>>>>
>>>>>
>>>>>> On Wed, 13 Aug 2003, Dennis Gearon wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Dennis Bj?rklund wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> In the future we need indexes that depend on the locale (and a
>>>>>>>> lot of other changes).
>>>>>>>>
>>>>>>>
>>>>>>> I agree. I've been looking at the web on this subject a lot
>>>>>>> lately. I
>>>>>>> am **NOT** a microslop fan, but SQL-SERVER even lets a user define a
>>>>>>> language(maybe encoding) down to the column level!
>>>>>>>
>>>>>>> I've been reading on GNU-C and on languages, encoding, and
>>>>>>> localization.
>>>>>>>
>>>>>>> http://pauillac.inria.fr/~lang/hotlist/free/licence/fsf96/drepper/paper-1.html
>>>>>>>
>>>>>>> http://h21007.www2.hp.com/dspp/tech/tech_TechSingleTipDetailPage_IDX/1,2366,1222,00.html
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> There are three basic approaches to doing different langauges in
>>>>>>> computerized text:
>>>>>>>
>>>>>>> A/ various adaptations of the 8 bit character set, I.E. the
>>>>>>> ISO-8859-x series.
>>>>>>> B/ wide characters
>>>>>>> ********This should be how Postgress stores data
>>>>>>> internally.********
>>>>>>> C/ Multibyte characters
>>>>>>> ********This is how Postgress should default to sending data
>>>>>>> OUT of the application,
>>>>>>> i.e. to the display or the web, or other system
>>>>>>> applications********
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> SQL has a system for defining character set specifications,
>>>>>> collations and
>>>>>> such (per column/literal in some cases). We should probably look
>>>>>> at it
>>>>>> before making decisions on how to do things.
>>>>>
>>>>>
>>>>>
>>>> I thought UNIX (SCOTM) systems also had a way of being able to
>>>> define collation order.
>>>>
>>>> see:
>>>> ftp://dkuug.dk/i18n/WG15-collection/locales
>>>>
>>>> for a collection of all ISO standardized locales (the WG15 ISO work
>>>> group's stuff).
>>>>
>>>> Do a "man localedef" on most Linuxen or UNIXen.
>>>>
>>>> As for wide characters vs multibyte, there is no clear winner. The
>>>> right answer DEPENDS on the situation.
>>>>
>>>> Wide characters on some platforms are 16 bit which means that when
>>>> you do Unicode you'll still have problems with surrogate pairs
>>>> (meaning that it's still multi (wide) char) so you still have all
>>>> the problems of multi-byte encodings.
>>>>
>>>> You could decide to process everything in a PG specific 4 byte wide
>>>> char and do all text in Unicode but the overhead in processing 4
>>>> times the data is quite significant. The other option is to store
>>>> all data in utf-8 and have all text code become utf-8 aware.
>>>>
>>>> I have found in practice that the utf-8 option is significantly
>>>> easier to implement, 100% Unicode compliant and the best performer
>>>> (because of reduced memory requirements).
>>>> The Posix API's for locales are not very good for modern day
>>>> programs, I'm not sure where the "mbr*" and the "wcr*" apis are in
>>>> the standardization process but if these are not well supported,
>>>> you're on your own and will need to implement similar functionality
>>>> from scratch and for that matter, the collation functions all
>>>> operate on a "current" locate which is really difficult to work with
>>>> on multi-locale applications.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------(end of
>>>> broadcast)---------------------------
>>>> TIP 8: explain analyze is your friend
>>>>
>>>
>>>
>>> ---------------------------(end of broadcast)---------------------------
>>> TIP 7: don't forget to increase your free space map settings
>>>
>>
>>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match

--


From: Dennis Gearon <gearond(at)cvc(dot)net>
To: Kathy zhu <Kathy(dot)zhu(at)Sun(dot)COM>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Gianni Mariani <gianni(at)mariani(dot)ws>, pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-13 21:43:08
Message-ID: 3F3AB0EC.6040307@cvc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

From what I've read, the db will ONLY sort on the language it was 'initdb'd on. I guess the 'C' locale should would sort it sort of, in other languages.

Kathy zhu wrote:

> Ok, thanks for all the discussion followed, vey educational :-))
> But nobody really followed up my question :-(
>
> For example, you have a table that is displayed in the browser. You want
> to let the user do sorting on one or multible columns, including those
> which contain localized strings.
>
> If the db supports sorting for multi-linguages, you can retreive all the
> rows and do "ORDER BY" on the columns directly.
>
> But if db doesn't support that, in Java, you will have to retrieve all
> the rows first, sort the objects on multiple columnes listed in the
> "ORDER BY" in java. It is much slower than the previous one.
>
> My problem is that if initdb is done with en_US, if a customer in Japan
> request the page with that sorted table, the text is not sorted in a
> Japanese one. Then I have a problem.
>
> Any suggestions on that ??
>
>
> Dennis Gearon wrote:
>
>> I agree, mostly. In the case of a database, I would bet that the
>> INTERNAL, IN-APPLICATION processing FAAAAAAAAAAARRRRRRRRRRR exceeds
>> that of sending and receiving it.
>>
>> i.e. comparisons, sorts, triggers, indexes, views, functions,
>> logging to tables, ordering by,
>> grouping, etc.
>>
>> except backups, restores, logging to text files (these would be
>> good in UTF8)
>>
>> Bruce Momjian wrote:
>>
>>> I think the question is how often are you passing data around/storing it
>>> _in_ your application and how often are you processing it.
>>>
>>> ---------------------------------------------------------------------------
>>>
>>>
>>> Dennis Gearon wrote:
>>>
>>>> I agree with all of that except for one caveat:
>>>>
>>>> all my reading, and just general off the cuff thinking, says
>>>> that processing variable width characters SIGNIFICANTLY slows an
>>>> application. It seems better to PROCESS fixed width characters
>>>> (1,2,4 byte), and TRANSMIT variable width characters (avoiding the
>>>> null problem.)
>>>>
>>>> Gianni Mariani wrote:
>>>>
>>>>
>>>>> Dennis Gearon wrote:
>>>>>
>>>>>
>>>>>> Got a link to that section of the standard, or better yet, to a
>>>>>> 'interpreted' version of the standard? :-)
>>>>>>
>>>>>> Stephan Szabo wrote:
>>>>>>
>>>>>>
>>>>>>> On Wed, 13 Aug 2003, Dennis Gearon wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Dennis Bj?rklund wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> In the future we need indexes that depend on the locale (and a
>>>>>>>>> lot of other changes).
>>>>>>>>>
>>>>>>>>
>>>>>>>> I agree. I've been looking at the web on this subject a lot
>>>>>>>> lately. I
>>>>>>>> am **NOT** a microslop fan, but SQL-SERVER even lets a user
>>>>>>>> define a
>>>>>>>> language(maybe encoding) down to the column level!
>>>>>>>>
>>>>>>>> I've been reading on GNU-C and on languages, encoding, and
>>>>>>>> localization.
>>>>>>>>
>>>>>>>> http://pauillac.inria.fr/~lang/hotlist/free/licence/fsf96/drepper/paper-1.html
>>>>>>>>
>>>>>>>> http://h21007.www2.hp.com/dspp/tech/tech_TechSingleTipDetailPage_IDX/1,2366,1222,00.html
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> There are three basic approaches to doing different langauges in
>>>>>>>> computerized text:
>>>>>>>>
>>>>>>>> A/ various adaptations of the 8 bit character set, I.E. the
>>>>>>>> ISO-8859-x series.
>>>>>>>> B/ wide characters
>>>>>>>> ********This should be how Postgress stores data
>>>>>>>> internally.********
>>>>>>>> C/ Multibyte characters
>>>>>>>> ********This is how Postgress should default to sending data
>>>>>>>> OUT of the application,
>>>>>>>> i.e. to the display or the web, or other system
>>>>>>>> applications********
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> SQL has a system for defining character set specifications,
>>>>>>> collations and
>>>>>>> such (per column/literal in some cases). We should probably look
>>>>>>> at it
>>>>>>> before making decisions on how to do things.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> I thought UNIX (SCOTM) systems also had a way of being able to
>>>>> define collation order.
>>>>>
>>>>> see:
>>>>> ftp://dkuug.dk/i18n/WG15-collection/locales
>>>>>
>>>>> for a collection of all ISO standardized locales (the WG15 ISO work
>>>>> group's stuff).
>>>>>
>>>>> Do a "man localedef" on most Linuxen or UNIXen.
>>>>>
>>>>> As for wide characters vs multibyte, there is no clear winner. The
>>>>> right answer DEPENDS on the situation.
>>>>>
>>>>> Wide characters on some platforms are 16 bit which means that when
>>>>> you do Unicode you'll still have problems with surrogate pairs
>>>>> (meaning that it's still multi (wide) char) so you still have all
>>>>> the problems of multi-byte encodings.
>>>>>
>>>>> You could decide to process everything in a PG specific 4 byte wide
>>>>> char and do all text in Unicode but the overhead in processing 4
>>>>> times the data is quite significant. The other option is to store
>>>>> all data in utf-8 and have all text code become utf-8 aware.
>>>>>
>>>>> I have found in practice that the utf-8 option is significantly
>>>>> easier to implement, 100% Unicode compliant and the best performer
>>>>> (because of reduced memory requirements).
>>>>> The Posix API's for locales are not very good for modern day
>>>>> programs, I'm not sure where the "mbr*" and the "wcr*" apis are in
>>>>> the standardization process but if these are not well supported,
>>>>> you're on your own and will need to implement similar functionality
>>>>> from scratch and for that matter, the collation functions all
>>>>> operate on a "current" locate which is really difficult to work
>>>>> with on multi-locale applications.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------(end of
>>>>> broadcast)---------------------------
>>>>> TIP 8: explain analyze is your friend
>>>>>
>>>>
>>>>
>>>> ---------------------------(end of
>>>> broadcast)---------------------------
>>>> TIP 7: don't forget to increase your free space map settings
>>>>
>>>
>>>
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 9: the planner will ignore your desire to choose an index scan if
>> your
>> joining column's datatypes do not match
>
>
>


From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Dennis Gearon <gearond(at)cvc(dot)net>
Cc: Gianni Mariani <gianni(at)mariani(dot)ws>, pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-13 23:43:48
Message-ID: 20030813234348.GA13887@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Wed, Aug 13, 2003 at 11:33:31AM -0700, Dennis Gearon wrote:
> Perhaps the only way to get around the cache problem is to use an
> ISO-8859-x 8bit character set, but to have per table, or per column
> encoding attributes. And of course, ways to access what those are, in the
> Postgres API. Good for speed, but not for easy storing of multiple
> language/encodings per column/table.

Well, each column will have to have a native encoding/collation order. This
is the one stored on disk and the one used for indexes. Remember, if your
index is collated by en_US and your query asks for nl_NL, you can't use your
query for sorting the result. I guess you could have the same column indexed
twice with the different collation orders.
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> "All that is needed for the forces of evil to triumph is for enough good
> men to do nothing." - Edmond Burke
> "The penalty good people pay for not being interested in politics is to be
> governed by people worse than themselves." - Plato


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Dennis Gearon <gearond(at)cvc(dot)net>
Cc: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, Dennis Björklund <db(at)zigo(dot)dhs(dot)org>, Maksim Likharev <mlikharev(at)aurigin(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-19 08:27:18
Message-ID: Pine.LNX.4.56.0308191027010.4847@krusty.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Dennis Gearon writes:

> If we really want to do it, we won't have to do the grunt work ourselves, just the tie-in, and Postgres specific implementation:
>
> http://www.unicode.org/reports/tr10/

It's already in the works.

--
Peter Eisentraut peter_e(at)gmx(dot)net


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Dennis Gearon <gearond(at)cvc(dot)net>, Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, Dennis Björklund <db(at)zigo(dot)dhs(dot)org>, Maksim Likharev <mlikharev(at)aurigin(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-19 13:27:20
Message-ID: 27601.1061299640@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> It's already in the works.

Oh? Please clue us in, if there's work going on that we don't know
about. Otherwise someone might be duplicating effort.

regards, tom lane


From: Dennis Gearon <gearond(at)cvc(dot)net>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, Dennis Björklund <db(at)zigo(dot)dhs(dot)org>, Maksim Likharev <mlikharev(at)aurigin(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting Problem
Date: 2003-08-19 15:56:28
Message-ID: 3F4248AC.8010509@cvc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Is there a list on this, that I could be part of ?

Peter Eisentraut wrote:

> Dennis Gearon writes:
>
>
>>If we really want to do it, we won't have to do the grunt work ourselves, just the tie-in, and Postgres specific implementation:
>>
>> http://www.unicode.org/reports/tr10/
>
>
> It's already in the works.
>