Re: [HACKERS] Possible solution for LIKE optimization

2001-08-07 Thread Oleg Bartunov
On Mon, 6 Aug 2001, Tom Lane wrote: > Giles Lean <[EMAIL PROTECTED]> writes: > > Implementations of strxfrm() that I've looked at have had result data > > that is three or four times larger than then input string -- quite a > > penalty in some situations. > > Especially so given that we don't hav

Re: [HACKERS] Possible solution for LIKE optimization

2001-08-06 Thread Hiroshi Inoue
Peter Eisentraut wrote: > > Hiroshi Inoue writes: > > > I'm not familiar with non_ASCII locale. > > Is 'ss' always guaranteed to be LIKE 's%' for example ? > > Yes. LIKE doesn't use any collation rules, since it doesn't do any > collating. > Hmm I see the description like the following in S

Re: [HACKERS] Possible solution for LIKE optimization

2001-08-06 Thread Tom Lane
Giles Lean <[EMAIL PROTECTED]> writes: > Implementations of strxfrm() that I've looked at have had result data > that is three or four times larger than then input string -- quite a > penalty in some situations. Especially so given that we don't have TOAST for indexes, so the indexed value can't

Re: [HACKERS] Possible solution for LIKE optimization

2001-08-06 Thread Giles Lean
[ I realise the discussion has left strxfrm(), but for the archives if nothing else ... ] Peter Eisentraut <[EMAIL PROTECTED]> wrote: > We'd need to implement the strxfrm() function in SQL and the $<=$ > operator, both of which are trivial. The index would have to be in terms > of strxfrm().

Re: [HACKERS] Possible solution for LIKE optimization

2001-08-06 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Tom Lane writes: >> On the other hand, LIKE *is* multibyte aware. So the hypothetical >> non-locale-aware comparison operators would need to be aware of >> multibyte character sets even though not aware of locale. And the >> "add one" operator that

RE: [HACKERS] Possible solution for LIKE optimization

2001-08-06 Thread Hiroshi Inoue
> -Original Message- > From: Tom Lane [mailto:[EMAIL PROTECTED]] > > Hiroshi Inoue <[EMAIL PROTECTED]> writes: > >> Peter Eisentraut <[EMAIL PROTECTED]> writes: > > Wait, why isn't that the solution in the first place. Let's build the > > index with an opclass that uses plain strcmp compa

Re: [HACKERS] Possible solution for LIKE optimization

2001-08-06 Thread Tom Lane
Hiroshi Inoue <[EMAIL PROTECTED]> writes: >> Peter Eisentraut <[EMAIL PROTECTED]> writes: > Wait, why isn't that the solution in the first place. Let's build the > index with an opclass that uses plain strcmp comparison. > Do we have to make 2 indexes for non_ASCII text field ? You would if you

Re: [HACKERS] Possible solution for LIKE optimization

2001-08-06 Thread Hiroshi Inoue
Tom Lane wrote: > > Peter Eisentraut <[EMAIL PROTECTED]> writes: > > Wait, why isn't that the solution in the first place. Let's build the > > index with an opclass that uses plain strcmp comparison. > > By George, I think you've got it! All we need is comparison ops and > an opclass that use s

Re: [HACKERS] Possible solution for LIKE optimization

2001-08-05 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Wait, why isn't that the solution in the first place. Let's build the > index with an opclass that uses plain strcmp comparison. By George, I think you've got it! All we need is comparison ops and an opclass that use strcmp, even when USE_LOCALE is

Re: [HACKERS] Possible solution for LIKE optimization

2001-08-05 Thread Peter Eisentraut
Tom Lane writes: > Peter Eisentraut <[EMAIL PROTECTED]> writes: > > I have had an idea how the LIKE optimization problem could be solved. > > Hmm ... so in a non-ASCII locale, we'd have to look for an index on > strxfrm(A) rather than directly on A. And the index would need to > use a nonstandar

Re: [HACKERS] Possible solution for LIKE optimization

2001-08-05 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > I have had an idea how the LIKE optimization problem could be solved. Hmm ... so in a non-ASCII locale, we'd have to look for an index on strxfrm(A) rather than directly on A. And the index would need to use a nonstandard operator set --- ie, *non*