Re: How can I speed up this function?
От | David Mitchell |
---|---|
Тема | Re: How can I speed up this function? |
Дата | |
Msg-id | 42C0C518.4020109@telogis.com обсуждение исходный текст |
Ответ на | Re: How can I speed up this function? (Keith Worthington <KeithW@NarrowPathInc.com>) |
Список | 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 по дате отправления: