X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1A1BC14B281D for ; Wed, 11 Aug 2004 13:40:40 -0300 (ADT) 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 20945-06 for ; Wed, 11 Aug 2004 16:40:31 +0000 (GMT) Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by svr1.postgresql.org (Postfix) with ESMTP id 0831B14B281C for ; Wed, 11 Aug 2004 13:40:27 -0300 (ADT) Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1Buw9L-0002BW-00 for ; Wed, 11 Aug 2004 18:40:27 +0200 Received: from linuxnews.dk ([81.7.132.92]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 11 Aug 2004 18:40:26 +0200 Received: from jesper by linuxnews.dk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 11 Aug 2004 18:40:26 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-performance@postgresql.org From: Jesper Krogh Subject: Re: Storing binary data. Date: Wed, 11 Aug 2004 16:29:33 +0000 (UTC) Lines: 32 Message-ID: References: <200408112042.50356.shridhar@frodo.hserus.net> X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: linuxnews.dk User-Agent: slrn/0.9.8.0 (Linux) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/161 X-Sequence-Number: 7797 I gmane.comp.db.postgresql.performance, skrev Shridhar Daithankar: > On Wednesday 11 Aug 2004 7:59 pm, Jesper Krogh wrote: > > The "common" solution, I guess would be to store them in the filesystem > > instead, but I like to have them just in the database it is nice clean > > database and application design and if I can get PostgreSQL to "not > > cache" them then it should be excactly as fast i assume. > > You can normalize them so that a table contains an id and a bytea column only. > Te main table will contain all the other attributes and a mapping id. That > way you will have only the main table cached. > > You don't have to go to filesystem for this, I hope. Further benchmarking. I tried to create a table with the excact same attributes but without the binary attribute. It didn't change anything, so my idea that it should be the binary-stuff that sloved it down was wrong. I have a timestamp column in the table that I sort on. Data is ordered over the last 4 years and I select based on a timerange, I cannot make the query-planner use the index on the timestamp by itself but if I "set enable_seqscan = false" the query time drops by 1/3 (from 1.200 msec to about 400 msec). I cannot figure out why the query-planner chooses wrong. NB: It's postgresql 7.4.3 -- ./Jesper Krogh, jesper@krogh.cc Jabber ID: jesper@jabbernet.dk