Re: Handling of images via Postgressql

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <s(dot)borse(at)direction(dot)biz>,<pgsql-admin(at)postgresql(dot)org>
Subject: Re: Handling of images via Postgressql
Date: 2010-04-07 14:26:50
Message-ID: 4BBC4FDA0200002500030555@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Suresh Borse <s(dot)borse(at)direction(dot)biz> 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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Bob Lunney 2010-04-07 16:21:28 Re: Handling of images via Postgressql
Previous Message Robert Gravsjö 2010-04-07 14:01:04 Re: Handling of images via Postgressql