X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DF24C3B6ED6 for ; Thu, 16 Dec 2004 11:01:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08634-04 for ; Thu, 16 Dec 2004 11:01:44 +0000 (GMT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.183]) by svr1.postgresql.org (Postfix) with ESMTP id 0FAF23B6ED7 for ; Thu, 16 Dec 2004 11:01:46 +0000 (GMT) Received: from [212.227.126.207] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1CetOD-000267-00 for pgsql-sql@postgresql.org; Thu, 16 Dec 2004 12:01:45 +0100 Received: from [194.25.154.138] (helo=pinguin.schollglas.com) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1CetOC-0002wt-00 for pgsql-sql@postgresql.org; Thu, 16 Dec 2004 12:01:44 +0100 Received: from kretschmer by pinguin.schollglas.com with local (Exim 3.33 #6) id 1CetO7-0001c5-00 for pgsql-sql@postgresql.org; Thu, 16 Dec 2004 12:01:39 +0100 Date: Thu, 16 Dec 2004 12:01:39 +0100 From: Andreas Kretschmer To: pgsql-sql@postgresql.org Subject: Re: [despammed] question about index Message-ID: <20041216110139.GA5899@Pinguin.wug-glas.de> References: <20041216104154.GA30578@mail.librelogiciel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041216104154.GA30578@mail.librelogiciel.com> User-Agent: Mutt/1.4i X-DEST: 208 X-MSMail-Priority: High X-MSMail-Virus: X5O!P%@AP[4PZX54(P^)7CC)7}-STANDARD-ANTIVIRUS-TEST-FILE!+H* X-Message-Flag: My name is root. Just root. And I am licensed to kill -9 X-PrivatMail: kretschmer@kaufbach.delug.de X-OS: Linux - weil ich es mir Wert bin! X-Info: registrierter Linux-User 97922 http://counter.li.org X-LUG: http://lug-dd.schlittermann.de X-Handy: 0160 / 8256486 (privat) X-Fax: 035204 / 40505 (privat) X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:51ea9561fc3f6d9539a2acd743e4748c X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.664 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_WHOIS, MISSING_MIMEOLE, X_MSMAIL_PRIORITY_HIGH X-Spam-Level: X-Archive-Number: 200412/102 X-Sequence-Number: 19722 am 16.12.2004, um 11:41:54 +0100 mailte Jerome Alet folgendes: > Hi, > > For a future databas, I plan to have got a table with a text field > which can contain only three different values, say "VALUE1", > "VALUE2", and "VALUE3" Why text-fields for this task? I would prefer a smallint for this with a check-contraint to check the values. > be as fast as possible. > > considering that almost 70% of the rows will be with 'VALUE1', 20% > will be with 'VALUE2' and 10% will be with 'VALUE3' on the average. > > should I create an index to speedup the counts or not ? Yes. Andreas -- Andreas Kretschmer (Kontakt: siehe Header) Tel. NL Heynitz: 035242/47212 GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net === Schollglas Unternehmensgruppe ===