Skip site navigation (1) Skip section navigation (2)

Re: How can I speed up this function?

From: David Mitchell <david(dot)mitchell(at)telogis(dot)com>
To: KeithW(at)NarrowPathInc(dot)com
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: How can I speed up this function?
Date: 2005-06-28 03:33:44
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
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.



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
> 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

In response to

pgsql-performance by date

Next:From: Gnanavel ShanmugamDate: 2005-06-28 04:06:11
Subject: Re: How can I speed up this function?
Previous:From: David MitchellDate: 2005-06-28 03:31:48
Subject: Re: How can I speed up this function?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group