Re: How can I speed up this function? - Mailing list pgsql-performance

From David Mitchell
Subject Re: How can I speed up this function?
Date
Msg-id 42C0C518.4020109@telogis.com
Whole thread Raw
In response to Re: How can I speed up this function?  (Keith Worthington <KeithW@NarrowPathInc.com>)
List 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.

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


pgsql-performance by date:

Previous
From: David Mitchell
Date:
Subject: Re: How can I speed up this function?
Next
From: Gnanavel Shanmugam
Date:
Subject: Re: How can I speed up this function?