Re: Optimization for updating foreign tables in Postgres FDW
От | Etsuro Fujita |
---|---|
Тема | Re: Optimization for updating foreign tables in Postgres FDW |
Дата | |
Msg-id | 570DADE2.9080200@lab.ntt.co.jp обсуждение исходный текст |
Ответ на | Re: Optimization for updating foreign tables in Postgres FDW (Robert Haas <robertmhaas@gmail.com>) |
Ответы |
Re: Optimization for updating foreign tables in Postgres FDW
Re: Optimization for updating foreign tables in Postgres FDW |
Список | pgsql-hackers |
On 2016/04/13 3:14, Robert Haas wrote: > I'm wondering why we are fixing this specific case and not any of the > other calls to PQexec() or PQexecParams() in postgres_fdw.c. > > I mean, many of those instances are cases where the query isn't likely > to run for very long, but certainly "FETCH %d FROM c%u" is in theory > just as bad as the new code introduced in 9.6. In practice, it > probably isn't, because we're probably only fetching 50 rows at a time > rather than potentially a lot more, but if we're fixing this code up > to be interrupt-safe, maybe we should fix it all at the same time. > Even for the short-running queries like CLOSE and DEALLOCATE, it seems > possible that there could be a network-related hang which you might > want to interrupt. Actually, I was wondering, too, but I didn't propose that because, as far as I know, there are no reports from the field. But I agree with you. > How about we encapsulate the while (PQisBusy(...)) loop into a new > function pgfdw_get_result(), which can be called after first calling > PQsendQueryParams()? So then this code will say dmstate->result = > pgfdw_get_result(dmstate->conn). And we can do something similar for > the other call to PQexecParams() in create_cursor(). Then let's also > add something like pgfdw_exec_query() which calls PQsendQuery() and > then pgfdw_get_result, and use that to replace all of the existing > calls to PQexec(). > > Then all the SQL postgres_fdw executes would be interruptible, not > just the new stuff. Seems like a good idea. Will do. Best regards, Etsuro Fujita
В списке pgsql-hackers по дате отправления: