pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Mitchell <david.mitchell@telogis.com>
To: KeithW@NarrowPathInc.com
Cc: pgsql-performance@postgresql.org
Subject: Re: How can I speed up this function?
Date: Tue, 28 Jun 2005 15:33:44 +1200
Message-ID: <42C0C518.4020109@telogis.com> (raw)
In-Reply-To: <42C0C226.8070201@NarrowPathInc.com>
References: <42C0B7EE.4040608@telogis.com>
	<42C0C226.8070201@NarrowPathInc.com>

Hi Keith,

Unfortunately, we must have those sorts. The statements within a 
transaction must be executed on the slave in the same order as they were 
on the master, and similarly, transactions must also go in the same 
order. As for aliasing the tables, that is just a remnant from previous 
versions of the code.

Thanks

David

Keith Worthington wrote:
> I'm still a newbie and it may not affect performance but why are you 
> aliasing the tables?  Can you not simply use
> 
> FOR transaction IN SELECT trans_id
>                      FROM pending_trans
>                     WHERE fetched = false
>                     ORDER BY trans_id
>                     LIMIT 50
> 
> and
> 
> FOR statement IN SELECT id,
>                         transaction_id,
>                         table_name,
>                         op,
>                         data
>                    FROM dbmirror.pending_statement
>                   WHERE pending_statement.transaction_id =
>                         transaction.trans_id
>                   ORDER BY pending_statement.id
> 
> I am pretty sure that the ORDER BY is slowing down both of these 
> queries.  Since you are going to go through the whole table eventually 
> do you really need to sort the data at this point?
> 


-- 
David Mitchell
Software Engineer
Telogis




view thread (13+ messages)  latest in thread

Message-ID: <42C0C518.4020109@telogis.com>
Permalink:  ../42C0C518.4020109@telogis.com/
Also on:    postgresql.org/message-id/42C0C518.4020109@telogis.com

 · 

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: david.mitchell@telogis.com, KeithW@NarrowPathInc.com
  Subject: Re: How can I speed up this function?
  In-Reply-To: <42C0C518.4020109@telogis.com>

* 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