Re: Calling conventions - Mailing list pgsql-performance

From Kevin Grittner
Subject Re: Calling conventions
Date
Msg-id 4A64956002000025000289D9@gw.wicourts.gov
Whole thread Raw
In response to Re: Calling conventions  (Matthew Wakeling <matthew@flymine.org>)
Responses Re: Calling conventions
Re: Calling conventions
List pgsql-performance
Matthew Wakeling <matthew@flymine.org> wrote:

> On Fri, 17 Jul 2009, Kevin Grittner wrote:

>> but a factor of 100?

> The Java code runs all in RAM, versus Postgres running all from OS
> cache or Postgres shared buffer (bit  hard to tell which of those
> two it is - there is no hard drive activity anyway). The Java code
> does no page locking, whereas Postgres does loads.  The Java code is
> emulating just the index, whereas Postgres is fetching the whole row
> as well.

Oh, well, if you load all the data into Java's heap and are accessing
it through HashMap or similar, I guess a factor of 100 is about right.
I see the big difference as the fact that the Java implementation is
dealing with everything already set up in RAM, versus needing to deal
with a "disk image" format, even if it is cached.  Try serializing
those Java objects to disk and storing the file name in the HashMap,
retrieving and de-serializing the object for each reference.  Even if
it's all cached, I expect you'd be running about 100 times slower.

The Java heap isn't a very safe place to persist long-term data,
however.

-Kevin

pgsql-performance by date:

Previous
From: Krade
Date:
Subject: Re: Full text search with ORDER BY performance issue
Next
From: Merlin Moncure
Date:
Subject: Re: Fastest char datatype