Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 705009FB731 for ; Tue, 24 Jul 2007 23:29:07 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 33811-03 for ; Tue, 24 Jul 2007 23:28:57 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.176]) by postgresql.org (Postfix) with ESMTP id A75AF9FB61F for ; Tue, 24 Jul 2007 23:29:03 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d32so115335pye for ; Tue, 24 Jul 2007 19:29:02 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; b=Ff5y02MdgyNi575KmzmksrmYHt6mqKkICN8H9DBdTOIjzpIQKtC+mfP6RgFCN3W6AlBKLR3X2ADNJrcidi7uCcq3fRLIrc/Y+Tl1KCBEfuBi6tggX5d24xakuXS5xN+Lj8NqACj18w4QRVOdptd1Q+U6tkUjZCxhGUzSkMBVteU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; b=U/tl83+NuBAYfQ9BMB1ufJFKS5R9bB3tkeNOEYmJfU98HhSLpTqS0uqrrTG7b++a+0N8OuFs+GLqW9BS2Aln0pZ7qq8g02RRqUyBwlgt1aSQ80EXGMgEdtNqMUSp/iIaWRovW6Fmhmqwx36ugAT8blfW77bSRQaYE96w6gk/6DM= Received: by 10.35.121.12 with SMTP id y12mr8733504pym.1185330541849; Tue, 24 Jul 2007 19:29:01 -0700 (PDT) Received: from ?172.17.0.199? ( [204.11.129.146]) by mx.google.com with ESMTPS id 8sm665186nzn.2007.07.24.19.29.00 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 24 Jul 2007 19:29:01 -0700 (PDT) Message-ID: <46A6B56E.3040405@gmail.com> Date: Tue, 24 Jul 2007 21:29:02 -0500 From: Peter Koczan User-Agent: Thunderbird 2.0.0.4 (X11/20070619) MIME-Version: 1.0 To: Ben Kim CC: Jessica Richard , pgsql-admin@postgresql.org Subject: Re: "_" in a serach pattern References: <829317.804.qm@web56414.mail.re3.yahoo.com> <46A54962.30109@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/268 X-Sequence-Number: 26249 Most database systems can figure out the size (in bytes) of a column rather quickly from offsets within a record. I doubt that postgres is any different. The only difference I can think of is that it might be slower to filter out trailing spaces of a char column before comparing, though the actual string length may be cached somewhere. Semantically, it should be no different. I haven't perused the source code enough to know for sure. Any of the developers that patrol this list can probably answer your questions better, especially the question of matching or not matching strings of different length. Peter Ben Kim wrote: >> The only difference is that varchar can have a length limit, text is >> always unlimited length. There's no significant performance >> difference between either. For most intents and purposes, they're equal. > > Forgive me for diversion, but out of curiosity, would it make some > difference whether strings of known length are compared or strings of > unknown length are compared, like in join condition "using(address)"? > > Or, is the actual length stored in a separate field and read first so > strings of different lengths wouldn't even need to be matched? > > Is there some reference on this subject other than the source code? > > > Thanks. > > Ben K. > Developer > http://benix.tamu.edu >