pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mike Benoit <ipso@snappymail.ca>
To: Martin Foster <martin@ethereal-realms.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: Performance Bottleneck
Date: Sun, 08 Aug 2004 01:21:17 -0700
Message-ID: <1091953277.11520.3.camel@ipso.snappymail.ca> (raw)
In-Reply-To: <tlUQc.32079$cd2.29211@clgrps12>
References: <ktQPc.23297$yT2.16983@clgrps13>
	<410FDC53.5080509@bigfoot.com>
	<X0ZPc.23543$yT2.23053@clgrps13>
	<4110FFF6.1030001@bigfoot.com>
	<1091812011.7149.25.camel@ipso.snappymail.ca>
	<tlUQc.32079$cd2.29211@clgrps12>

On Fri, 2004-08-06 at 23:18 +0000, Martin Foster wrote:
> Mike Benoit wrote:
> 
> > On Wed, 2004-08-04 at 17:25 +0200, Gaetano Mendola wrote:
> > 
> > 
> >>>The queries themselves are simple, normally drawing information from one 
> >>>table with few conditions or in the most complex cases using joins on 
> >>>two table or sub queries.   These behave very well and always have, the 
> >>>problem is that these queries take place in rather large amounts due to 
> >>>the dumb nature of the scripts themselves.
> >>
> >>Show us the explain analyze on that queries, how many rows the tables are
> >>containing, the table schema could be also usefull.
> >>
> > 
> > 
> > If the queries themselves are optimized as much as they can be, and as
> > you say, its just the sheer amount of similar queries hitting the
> > database, you could try using prepared queries for ones that are most
> > often executed to eliminate some of the overhead. 
> > 
> > I've had relatively good success with this in the past, and it doesn't
> > take very much code modification.
> > 
> 
> One of the biggest problems is most probably related to the indexes. 
> Since the performance penalty of logging the information needed to see 
> which queries are used and which are not is a slight problem, then I 
> cannot really make use of it for now.
> 
> However, I am curious how one would go about preparing query?   Is this 
> similar to the DBI::Prepare statement with placeholders and simply 
> changing the values passed on execute?  Or is this something database 
> level such as a view et cetera?
> 

Yes, always optimize your queries and GUC settings first and foremost.
Thats where you are likely to gain the most performance. After that if
you still want to push things even further I would try prepared queries.
I'm not familiar with DBI::Prepare at all, but I don't think its what
your looking for.

This is what you want:
http://www.postgresql.org/docs/current/static/sql-prepare.html


-- 
Mike Benoit <ipso@snappymail.ca>




view thread (38+ messages)  latest in thread

Message-ID: <1091953277.11520.3.camel@ipso.snappymail.ca>
Permalink:  ../1091953277.11520.3.camel@ipso.snappymail.ca/
Also on:    postgresql.org/message-id/1091953277.11520.3.camel@ipso.snappymail.ca

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: ipso@snappymail.ca, martin@ethereal-realms.org
  Subject: Re: Performance Bottleneck
  In-Reply-To: <1091953277.11520.3.camel@ipso.snappymail.ca>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox