Re: PostgreSQL+Hibernate Performance

From: "Nikolas Everett" <nik9000(at)gmail(dot)com>
To: "Mark Lewis" <mark(dot)lewis(at)mir3(dot)com>
Cc: Kranti K K Parisa™ <kranti(dot)parisa(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: PostgreSQL+Hibernate Performance
Date: 2008-08-20 15:04:42
Message-ID: d4e11e980808200804v88bf06dt3ba6711b5feb28f8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

The only thing thats bitten me about hibernate + postgres is that when
inserting into partitioned tables, postgres does not reply with the number
of rows that hibernate expected. My current (not great) solution is to
define a specific SQLInsert annotation and tell it not to do any checking
like so:

@SQLInsert(sql="insert into bigmetric (account_id, a, b, timestamp, id)
values (?, ?, ?, ?, ?)", check=ResultCheckStyle.NONE)

I just steel the sql from the SQL from hibernate's logs.

On Wed, Aug 20, 2008 at 10:40 AM, Mark Lewis <mark(dot)lewis(at)mir3(dot)com> wrote:

> On Wed, 2008-08-20 at 17:55 +0530, Kranti K K Parisa™ wrote:
> > Hi,
> >
> > Can anyone suggest the performance tips for PostgreSQL using
> > Hibernate.
> >
> > One of the queries:
> >
> > - PostgreSQL has INDEX concept and Hibernate also has Column INDEXes.
> > Which is better among them? or creating either of them is enough? or
> > need to create both of them?
> >
> > and any more performace aspects ?
>
> Hibernate is a library for accessing a database such as PostgreSQL. It
> does not offer any add-on capabilities to the storage layer itself. So
> when you tell Hibernate that a column should be indexed, all that it
> does create the associated PostgreSQL index when you ask Hibernate to
> build the DB tables for you. This is part of Hibernate's effort to
> protect you from the implementation details of the underlying database,
> in order to make supporting multiple databases with the same application
> code easier.
>
> So there is no performance difference between a PG index and a Hibernate
> column index, because they are the same thing.
>
> The most useful Hibernate performance-tuning advice isn't PG-specific at
> all, there are just things that you need to keep in mind when developing
> for any database to avoid pathologically bad performance; those tips are
> really beyond the scope of this mailing list, Google is your friend
> here.
>
> I've been the architect for an enterprise-class application for a few
> years now using PostgreSQL and Hibernate together in a
> performance-critical context, and honestly I can't think of one time
> that I've been bitten by a PG-specific performance issue (a lot of
> performance issues with Hibernate that affected all databases though;
> you need to know what you're doing to make Hibernate apps that run fast.
> If you do run into problems, you can figure out the actual SQL that
> Hibernate is issuing and do the normal PostgreSQL explain analyze on it;
> usually caused by a missing index.
>
> -- Mark
>
>
>
> --
> Sent via pgsql-performance mailing list (pgsql-performance(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Mark Wong 2008-08-20 15:05:54 Re: Software vs. Hardware RAID Data
Previous Message Mark Wong 2008-08-20 15:02:56 Re: Software vs. Hardware RAID Data