Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 5030B650EC1 for ; Mon, 30 Jun 2008 14:46:13 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 76976-05 for ; Mon, 30 Jun 2008 14:46:08 -0300 (ADT) X-Greylist: delayed 00:48:05.571763 by SQLgrey-1.7.6 Received: from smtp2b.orange.fr (smtp2b.orange.fr [80.12.242.144]) by postgresql.org (Postfix) with ESMTP id E9736650EBA for ; Mon, 30 Jun 2008 14:46:09 -0300 (ADT) Received: from smtp2b.orange.fr (mwinf2b11 [10.232.22.39]) by mwinf2b05.orange.fr (SMTP Server) with ESMTP id E9CAF1C04136 for ; Mon, 30 Jun 2008 18:58:04 +0200 (CEST) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2b11.orange.fr (SMTP Server) with ESMTP id 61AC03000084 for ; Mon, 30 Jun 2008 18:58:00 +0200 (CEST) Received: from axege.com (LNeuilly-152-22-82-133.w193-251.abo.wanadoo.fr [193.251.23.133]) by mwinf2b11.orange.fr (SMTP Server) with ESMTP id 3E22630000E7 for ; Mon, 30 Jun 2008 18:58:00 +0200 (CEST) X-ME-UUID: 20080630165800254.3E22630000E7@mwinf2b11.orange.fr Received: from localhost (localhost [127.0.0.1]) by axege.com (Postfix) with ESMTP id 90B3A4FEE8 for ; Mon, 30 Jun 2008 19:08:54 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at myhostname="axege.com." Received: from axege.com ([127.0.0.1]) by localhost (axege.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zrcn-ojIEc1O for ; Mon, 30 Jun 2008 19:08:53 +0200 (CEST) Received: from [10.0.0.69] (unknown [192.168.1.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by axege.com (Postfix) with ESMTPSA id D71594FE42 for ; Mon, 30 Jun 2008 19:08:53 +0200 (CEST) Subject: Does max size of varchar influence index size From: Franck Routier To: pgsql-performance@postgresql.org Content-Type: text/plain Date: Mon, 30 Jun 2008 18:57:58 +0200 Message-Id: <1214845078.6710.7.camel@franck-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.22.2 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200806/245 X-Sequence-Number: 30595 Hi, I have problems with my database becoming huge in size (around 150 GB right now, and 2/3 for only three tables, each having around 30 millions tuples. Space is spent mainly on indices.). I have a lot of multi-column varchar primary keys (natural keys), and lot of foreign keys on these tables and thus a lot of indices. When using VARCHAR, we defaulted to VARCHAR(32) (because on _some_ of the identifiers, we have to apply md5). We assumed that using VARCHAR(32) but having values at most 4 characters long (for example) wouldn't influence indices size, ie it would be the same as using VARCHAR(4) to keep the example. Now I really doubt if we were right :) So, what should we expect ? And are there other factors influencing indices size ? Thanks, Franck