Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TqoBN-0005AL-1i for pgsql-performance@arkaria.postgresql.org; Thu, 03 Jan 2013 17:02:17 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TqoBM-0003gT-Fn for pgsql-performance@arkaria.postgresql.org; Thu, 03 Jan 2013 17:02:16 +0000 Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TqoBL-0003ew-1s for pgsql-performance@postgresql.org; Thu, 03 Jan 2013 17:02:15 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TqoB9-00075f-6m for pgsql-performance@postgresql.org; Thu, 03 Jan 2013 17:02:12 +0000 Received: from sc9-mailhost2.vmware.com (sc9-mailhost2.vmware.com [10.113.161.72]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id AB26828358; Thu, 3 Jan 2013 09:01:59 -0800 (PST) Received: from zcs-prod-ext-mta-2.vmware.com (zcs-prod-ext-mta-2.vmware.com [10.113.62.224]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id A87ABB04BB; Thu, 3 Jan 2013 09:01:59 -0800 (PST) Received: from localhost (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTP id 599E0C152F; Thu, 3 Jan 2013 09:01:59 -0800 (PST) X-Virus-Scanned: amavisd-new at zcs-prod-ext-mta-2.vmware.com Received: from zcs-prod-ext-mta-2.vmware.com ([127.0.0.1]) by localhost (zcs-prod-ext-mta-2.vmware.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nURjFs9gVLYZ; Thu, 3 Jan 2013 09:01:59 -0800 (PST) Received: from localhost (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTP id 332F8C1565; Thu, 3 Jan 2013 09:01:59 -0800 (PST) X-Virus-Scanned: amavisd-new at zcs-prod-ext-mta-2.vmware.com Received: from zcs-prod-ext-mta-2.vmware.com ([127.0.0.1]) by localhost (zcs-prod-ext-mta-2.vmware.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id UsOM6wDBKtHI; Thu, 3 Jan 2013 09:01:59 -0800 (PST) Received: from [192.168.1.90] (unknown [10.113.62.14]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTPSA id 75C23C152F; Thu, 3 Jan 2013 09:01:58 -0800 (PST) Message-ID: <50E5B990.5010101@vmware.com> Date: Thu, 03 Jan 2013 19:02:08 +0200 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.11) Gecko/20121122 Icedove/10.0.11 MIME-Version: 1.0 To: Daniel Westermann CC: "'pgsql-performance@postgresql.org'" Subject: Re: FW: performance issue with a 2.5gb joinded table References: <05F9B935C9F93D4DA5ED64B6D321477C215B00@bsw00i-1402.lcsys.ch> <05F9B935C9F93D4DA5ED64B6D321477C215B25@bsw00i-1402.lcsys.ch> In-Reply-To: <05F9B935C9F93D4DA5ED64B6D321477C215B25@bsw00i-1402.lcsys.ch> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -6.9 (------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 03.01.2013 15:30, Daniel Westermann wrote: > What additionally makes me wonder is, that the same table in oracle is taking much less space than in postgresql: > > SQL> select sum(bytes) from dba_extents where segment_name = 'TEST1'; > SUM(BYTES) > ---------- > 1610612736 > > select pg_relation_size('mgmtt_own.test1'); > pg_relation_size > ------------------ > 2502082560 > (1 row) > > (sysdba@[local]:7777) [bi_dwht]> \d+ mgmtt_own.test1 > Table "mgmtt_own.test1" > Column | Type | Modifiers | Storage | Description > ------------------------------+---------------+-----------+---------+------------- > slsales_batch | numeric(8,0) | | main | > slsales_checksum | numeric(8,0) | | main | > slsales_reg_id | numeric(8,0) | | main | > slsales_prod_id | numeric(8,0) | | main | > slsales_date_id | numeric(8,0) | | main | > slsales_pos_id | numeric(8,0) | | main | > slsales_amt_sales_gross | numeric(16,6) | | main | > slsales_amt_sales_discount | numeric(16,6) | | main | > slsales_units_sales_gross | numeric(8,0) | | main | > slsales_amt_returns | numeric(16,6) | | main | > slsales_amt_returns_discount | numeric(16,6) | | main | > slsales_units_returns | numeric(8,0) | | main | > slsales_amt_est_winnings | numeric(16,6) | | main | > Indexes: > "itest1" btree (slsales_date_id) CLUSTER, tablespace "mgmtt_idx" > "itest2" btree (slsales_prod_id), tablespace "mgmtt_idx" > Has OIDs: no > Tablespace: "mgmtt_dat" One difference is that numerics are stored more tightly packed on Oracle. Which is particularly good for Oracle as they don't have other numeric data types than number. On PostgreSQL, you'll want to use int4 for ID-fields, where possible. An int4 always takes up 4 bytes, while a numeric holding an integer value in the same range is typically 5-9 bytes. - Heikki -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance