Re: [GENERAL] interesting PHP/MySQL thread

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: gearond(at)cvc(dot)net
Cc: nolan(at)celery(dot)tssi(dot)com, The Hermit Hacker <scrappy(at)postgresql(dot)org>, Jan Wieck <JanWieck(at)Yahoo(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, Joe Conway <mail(at)joeconway(dot)com>, Advocacy PostgreSQL <pgsql-advocacy(at)postgresql(dot)org>, PostgreSQL-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: [GENERAL] interesting PHP/MySQL thread
Date: 2003-06-23 16:41:55
Message-ID: 200306231641.h5NGftj12393@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-advocacy pgsql-docs pgsql-general

Dennis Gearon wrote:
> Looks like there's some parts of that that would make a good todo.
>
> nolan(at)celery(dot)tssi(dot)com wrote:
>
> >>>Personally, if I want case insensitivity, I'll WRITE IT INTO THE CODE,
> >>>but I can see how some people might think that 'NOLAN', 'Nolan' and
> >>>'nolan' should be considered as the same data.
> >>
> >>Oh, you mean like "SELECT * FROM table WHERE field ~* 'nolan';"?
> >
> >
> > No, I mean as in "SELECT * FROM table WHERE field = 'nolan';"
> >
> > That will match values with any combination of upper and lower case
> > letters that fold to 'nolan': 'Nolan', 'NOLAN', etc.

We require ~* syntax for that, or upper()/lower().

> > Also, unlike PostgreSQL (at least in 7.3), if you define an index on
> > the column, mysql appears to use it for LIKE queries.
> >
> > "SELECT * FROM table WHERE field LIKE 'nolan%';"
> >
> > is very fast in mysql but not in 7.3, and even non-anchored LIKE searches
> > in mysql appear to be using the index.
> >
> > "SELECT * FROM table WHERE field LIKE '%nolan%';"
> >
> > executes considerably faster with an index on field than without one.

I would love to know how they can use an index for a non-anchored query,
i.e. what string are they indexing?

--
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

In response to

Responses

Browse pgsql-advocacy by date

  From Date Subject
Next Message scott.marlowe 2003-06-23 16:47:30 Re: [GENERAL] interesting PHP/MySQL thread
Previous Message Dennis Gearon 2003-06-23 16:36:08 Re: [GENERAL] interesting PHP/MySQL thread

Browse pgsql-docs by date

  From Date Subject
Next Message scott.marlowe 2003-06-23 16:55:09 Re: [GENERAL] interesting PHP/MySQL thread
Previous Message Dennis Gearon 2003-06-23 16:36:08 Re: [GENERAL] interesting PHP/MySQL thread

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2003-06-23 16:47:30 Re: [GENERAL] interesting PHP/MySQL thread
Previous Message Dennis Gearon 2003-06-23 16:36:08 Re: [GENERAL] interesting PHP/MySQL thread