X-Original-To: pgsql-advocacy-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 183FF30F724; Mon, 23 Jun 2003 16:29:56 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 03616-06; Mon, 23 Jun 2003 13:29:45 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id 4EB4130F617; Mon, 23 Jun 2003 13:29:09 -0300 (ADT) Received: from smtp6.jaring.my (smtp6.jaring.my [61.6.32.56]) by www.postgresql.com (Postfix) with ESMTP id 03BE1CF75E3; Mon, 23 Jun 2003 11:26:00 -0300 (ADT) Received: from nexus.localhost. ([219.95.60.247]) by smtp6.jaring.my (8.12.9/8.12.9) with ESMTP id h5NEMv3K039913; Mon, 23 Jun 2003 22:22:59 +0800 (MYT) (envelope-from lyeoh@pop.jaring.my) Message-Id: <5.2.1.1.1.20030623221452.02f7fd48@mbox.jaring.my> X-Sender: lyeoh@mbox.jaring.my (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 5.2.1 Date: Mon, 23 Jun 2003 22:23:23 +0800 To: nolan@celery.tssi.com, scrappy@postgresql.org (The Hermit Hacker) From: Lincoln Yeoh Subject: Re: [GENERAL] interesting PHP/MySQL thread Cc: scrappy@postgresql.org (The Hermit Hacker), JanWieck@Yahoo.com (Jan Wieck), pgman@candle.pha.pa.us (Bruce Momjian), josh@agliodbs.com (Josh Berkus), mail@joeconway.com (Joe Conway), pgsql-advocacy@postgresql.org (\"\"\"Advocacy PostgreSQL\"\"\"), pgsql-general@postgresql.org (PostgreSQL-general) In-Reply-To: <20030623053352.1457.qmail@celery.tssi.com> References: <20030623015333.E95856@hub.org> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; x-avg-checked=avg-ok-A43CE7; charset=us-ascii; format=flowed X-Archive-Number: 200306/187 X-Sequence-Number: 1399 At 12:33 AM 6/23/2003 -0500, nolan@celery.tssi.com wrote: > > > > 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. For me that's a matter of taste. I prefer to use = for case sensitive and lower(field)=lower('data') for case insensitive. I wonder if there is a difference between using lower vs upper for case insensitivity but I've never bothered to look deeply into it. >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. The versions of Postgresql I've used since I can remember (e.g. at least v6.5.3 some years ago) use indexes for anchored LIKE searches. I vaguely recall some people having this "not using index" behaviour when they are using various locales. > "SELECT * FROM table WHERE field LIKE '%nolan%';" > >executes considerably faster with an index on field than without one. I think MySQL wins in this one. Just wondering how they do it. And whether it's a good idea to do it that way. Regards, Link.