Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C66A4475C60 for ; Mon, 20 Jan 2003 10:12:21 -0500 (EST) Received: from email05.aon.at (WARSL402PIP5.highway.telekom.at [195.3.96.79]) by postgresql.org (Postfix) with SMTP id EE180475AD4 for ; Mon, 20 Jan 2003 10:12:20 -0500 (EST) Received: (qmail 207268 invoked from network); 20 Jan 2003 15:12:24 -0000 Received: from m156p021.dipool.highway.telekom.at (HELO cantor) ([62.46.9.117]) (envelope-sender ) by qmail5rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 20 Jan 2003 15:12:24 -0000 From: Manfred Koizar To: mlennert@club.worldonline.be Cc: pgsql-sql@postgresql.org Subject: Re: performance question Date: Mon, 20 Jan 2003 16:13:37 +0100 Message-ID: <1k3o2v01b5ceh937kibrojn2fjks3fc93t@4ax.com> References: <59665.164.15.128.4.1043062834.squirrel@http://moritz.homelinux.org> In-Reply-To: <59665.164.15.128.4.1043062834.squirrel@http://moritz.homelinux.org> X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/298 X-Sequence-Number: 11163 On Mon, 20 Jan 2003 12:40:34 +0100 (CET), "Moritz Lennert" wrote: >I have a table with some 2.2 million rows on a Pentium4, 1.8GHz with 512 >MB RAM. >Some queries I launch take quite a long time, and I'm wondering whether >this is normal,or whether I can get better performance somehow. Moritz, we need more information. Please show us . your PG version . CREATE TABLE ... . indices . your query . EXPLAIN ANALYZE output . your settings, especially shared_buffers, sort_mem, random_page_cost, effective_cache_size >One question I asked myself is whether the use of char(2) is the best >option. The column (and most others in the table) contains codes that >designate different characteristics (for ex. in a column 'sex' one would >find '1'=male, '2'=female). char(2) needs 8 bytes, smallint only 2 bytes (unless followed by a column with 4 or 8 byte alignment). Instead of char(1) (8 bytes) you might want to use the Postgres specific type "char" (with the double quotes!) needing only 1 byte. Servus Manfred