X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7D1C5D1B8D9 for ; Wed, 20 Aug 2003 13:01:02 -0300 (ADT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 96795-09 for ; Wed, 20 Aug 2003 13:00:52 -0300 (ADT) Received: from china.maxbaud.net (adsl-64-218-99-66.meers.com [64.218.99.66]) by svr1.postgresql.org (Postfix) with ESMTP id 2C020D1BA14 for ; Wed, 20 Aug 2003 13:00:50 -0300 (ADT) Received: from fw.mccons.net (server.mccons.net.be [192.168.0.226]) by china.maxbaud.net (8.12.3/8.12.3) with ESMTP id h7KG0mJA091029 for ; Wed, 20 Aug 2003 11:00:48 -0500 (CDT) (envelope-from bmccane@mccons.net) Date: Wed, 20 Aug 2003 11:00:48 -0500 (CDT) From: Brian McCane To: pgsql-admin@postgresql.org Subject: Compression of text fields In-Reply-To: Message-ID: <20030820104038.P88296-100000@fw.mccons.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/226 X-Sequence-Number: 9947 I have read somewhere that text fields are "compressed". What I am curious about is how the compression of text fields by PostgreSQL might be affecting the performance of my software. I currently store entire copies of documents in a table called "fulltext" as such: CREATE TABLE fulltext ( uid serial8 PRIMARY KEY, content text NOT NULL, contentidx txtidx ) ; As you can see, I am using contrib/tsearch to find documents for display, and then I dump out 'content' to the user. Anyway, when I first created this table, I was concerned about the size of 'content' so I linked my program to zlib and deflate the content field before storing it into the table. This means that every time someone views a document I have to inflate it, also if what I have read is correct about the text fields, PostgreSQL is trying to deflate/compress/whatever the field when it stores it so I am duplicating effort. This probably slows down the performance of my software, and because compressed documents are often larger when re-compressed (at least with older algorithms like LZW) I might be using extra space to store my data. So: 1) do text fields get compressed 2) what compression method is used 3) is there a way to view actual storage space used versus the value I get from length() 4) Can I disable the compression to improve storage speed if the compression algorithm is not as good as deflate - brian Wm. Brian McCane | Life is full of doors that won't open Search http://recall.maxbaud.net/ | when you knock, equally spaced amid those Usenet http://freenews.maxbaud.net/ | that open when you don't want them to. Auction http://www.sellit-here.com/ | - Roger Zelazny "Blood of Amber"