Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id AF3969FB483 for ; Wed, 18 Oct 2006 04:06:41 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 88356-02 for ; Wed, 18 Oct 2006 07:06:34 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) by postgresql.org (Postfix) with ESMTP id 421069FA350 for ; Wed, 18 Oct 2006 04:06:28 -0300 (ADT) Received: (qmail 31553 invoked by uid 514); 18 Oct 2006 09:06:19 +0200 Received: from 62.37.216.182 by rigodon (envelope-from , uid 512) with qmail-scanner-1.25-st-qms (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. Clear:RC:0(62.37.216.182):SA:0(-2.3/5.0):. Processed in 2.559738 secs); 18 Oct 2006 07:06:19 -0000 X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.216.182):SA:0(-2.3/5.0):. Processed in 2.559738 secs Process 31521) Received: from 182.pool62-37-216.dynamic.uni2.es (HELO ?192.168.2.28?) (ruben@rentalia.com@62.37.216.182) by mail.rentalia.net with SMTP; 18 Oct 2006 09:06:16 +0200 Message-ID: <4535D26C.1010404@rentalia.com> Date: Wed, 18 Oct 2006 09:06:20 +0200 From: Ruben Rubio User-Agent: Thunderbird 1.5.0.7 (X11/20060922) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Optimization of this SQL sentence References: <45349CDF.3090002@rentalia.com> <4534A35E.9030909@rentalia.com> <181E6D21-8326-4ED6-A9AE-6F9917C1C319@purefiction.net> <200610171729.19596.mweilguni@sime.com> <60wt6y7r16.fsf@dba2.int.libertyrms.com> In-Reply-To: <60wt6y7r16.fsf@dba2.int.libertyrms.com> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200610/342 X-Sequence-Number: 21471 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >> so, imo alexander is correct: >> contacto varchar(255) Why do we have limits on this, for example? contacto varchar(255) 1) First of all, this is a web application. People use to enter really strange thinks there, and a lot of rubbish. So, as someone commented before, I am ok with the idea of limit the field. 2) Again, this is a web application. We could just limit the "field front end length" but this will be not secure. We could limit the field front end, and limit it with the code that process the data, but is much secure if we just limit field in database. Why 255? This is free field. We are interested in users enter as much data as needed (with a limit, we no not want "The Quijote" in that field) People use to imput as spected: "Contact: Baltolomé Peralez." But people also inserts thinks as: "Contact: In the mornings, Bartolomé Perales, in the afternoons Juan Perales in the same telephone number" In the context of the application, we are not interested in stopping the user with a message "Hey, Your contact is too long". We want the user to go on. That's why 255. We could insert 260. Or maybe 250. But someone decided 255 and for me its OK. Please remember that I just put some data of a large applications, and there is thinks there that has sense in context. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFNdJsIo1XmbAXRboRAuGVAKCupfXOHwxXOPHFdq+K6S0lXWNZUwCgml1i CS0eEJcQndEJb7h7Nsfh1CM= =0gpW -----END PGP SIGNATURE-----