Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id B6E506501CD for ; Wed, 20 Aug 2008 12:06:02 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 85579-04-5 for ; Wed, 20 Aug 2008 12:05:48 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.176]) by postgresql.org (Postfix) with ESMTP id 7A0C8650166 for ; Wed, 20 Aug 2008 12:04:45 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d37so333271pye.29 for ; Wed, 20 Aug 2008 08:04:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=wqrO5RR2O5699JC/VMV/ZtR2oyseq5YOpHJxxz2VoY4=; b=v07Zzzlk/V1MxDxXTG8jh9rh4m8vQSukMhS1o3wtP6thusdO7kK/UydcmSt0BkuIk9 LrVQgTuk19CYNmUmlP04DoYzBnNXaKCZA3BZXotH/CtFf9ZfFKBz2YUUiKdWrmiOHGEf Lu1s4rMLgUP8DmcrcYVamFDfu+4vY6PoPlTHI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=I4x9t82MppOBQqTDympWdqkaFEQE/uBbOY+FXeurqCwJJXjobFU+iOUO826r/3/5P1 S5LaHGhTj2qPWc1ARDQ7NcrWCqOMPWtinfSsRIop4bIjKPAY9i+/xsztCeE33gPIZz4h jIFqhS7M4Uba7nfuuawcbJR4NGzrw/BUBexuo= Received: by 10.115.19.16 with SMTP id w16mr235123wai.102.1219244683028; Wed, 20 Aug 2008 08:04:43 -0700 (PDT) Received: by 10.114.120.19 with HTTP; Wed, 20 Aug 2008 08:04:42 -0700 (PDT) Message-ID: Date: Wed, 20 Aug 2008 11:04:42 -0400 From: "Nikolas Everett" To: "Mark Lewis" Subject: Re: PostgreSQL+Hibernate Performance Cc: "=?WINDOWS-1252?Q?Kranti_K_K_Parisa=99?=" , pgsql-performance@postgresql.org In-Reply-To: <1219242910.7023.94.camel@archimedes.mir3.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_17282_1710102.1219244683017" References: <4478b4ac0808200525ia6eabe8q886ac7fbba53ff05@mail.gmail.com> <1219242910.7023.94.camel@archimedes.mir3.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200808/220 X-Sequence-Number: 31101 ------=_Part_17282_1710102.1219244683017 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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=3D"insert into bigmetric (account_id, a, b, timestamp, id) values (?, ?, ?, ?, ?)", check=3DResultCheckStyle.NONE) I just steel the sql from the SQL from hibernate's logs. On Wed, Aug 20, 2008 at 10:40 AM, Mark Lewis wrote: > On Wed, 2008-08-20 at 17:55 +0530, Kranti K K Parisa=99 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@postgresql.org= ) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-performance > ------=_Part_17282_1710102.1219244683017 Content-Type: text/html; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
The only thing thats bitten me about hibernate + postgres = is that when inserting into partitioned tables, postgres does not reply wit= h 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=3D"insert into bigmetric (account_id, a, b, timesta= mp, id) values (?, ?, ?, ?, ?)", check=3DResultCheckStyle.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.lewis@mir3.c= om> wrote:
On Wed, 2008-08-20 at 17:55 +0530, Kr= anti K K Parisa=99 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.<= br> > 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 Postgre= SQL.  It
does not offer any add-on capabilities to the storage layer itself.  S= o
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 t= o
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 a= t
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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

------=_Part_17282_1710102.1219244683017--