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: 42C0C518.4020109@telogis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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.

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

In response to

Browse pgsql-performance by date

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