Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id ADC856348C8 for ; Wed, 7 Apr 2010 11:27:53 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 59634-02 for ; Wed, 7 Apr 2010 14:27:32 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gw.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id A0256634DB5 for ; Wed, 7 Apr 2010 11:26:53 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Wed, 07 Apr 2010 09:26:51 -0500 Message-Id: <4BBC4FDA0200002500030555@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Wed, 07 Apr 2010 09:26:50 -0500 From: "Kevin Grittner" To: , Subject: Re: Handling of images via Postgressql References: <1270644614.2390.44.camel@dss-052.dsslp.com> In-Reply-To: <1270644614.2390.44.camel@dss-052.dsslp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.52 tagged_above=-10 required=5 tests=AWL=-0.780, BAYES_20=-0.74 X-Spam-Level: X-Archive-Number: 201004/67 X-Sequence-Number: 34161 Suresh Borse wrote: > How does PostGreSQL perform in case we have to store and use huge > no of images: > > Eg 4000 * 10000 images, each approx 2 MB size. We have a database with a table containing 7.5 million rows, each having an image in a bytea column. While the average size is only 15.2 kB, 69,000 of the rows are 2 MB or larger. Performance is fine, but this is a pretty large machine. > How do we handle such huge no of images so that the application > does not slow down? I would avoid doing a select of all 10,000 rows in a single result set. If you're getting multiple images in a result set, you might consider using a cursor. > How does PostGreSQL use caching? It has its own cache in shared memory, and also tends to use the OS's cache -- just by virtue of doing the disk I/O through the OS. > In case of images does it cache? Yes. > Do you suggest having the images in a different database by > itself? No. Well, not unless it is unrelated to other data in the database. If it's related, you're going to want to define foreign keys, join images to other data, and be able to have transactional integrity between the images and other data. If you want those things, keep them in the same database. -Kevin