public inbox for [email protected]
help / color / mirror / Atom feedFrom: George Neuner <[email protected]>
To: Mariel Cherkassky <[email protected]>
Cc: [email protected]
Subject: Re: printing results of query to file in different times
Date: Wed, 6 Sep 2017 12:55:32 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+t6e1kbSHK4qWmHY3nD3L6rhGvhY5gx3XAKEJwfoWoKm6_GLw@mail.gmail.com>
References: <[email protected]>
<CA+t6e1kS59uQ7HYSrx-KH2ieFLhJUsnprJ1rGBNPvO1n0YjvbA@mail.gmail.com>
<[email protected]>
<CA+t6e1kbSHK4qWmHY3nD3L6rhGvhY5gx3XAKEJwfoWoKm6_GLw@mail.gmail.com>
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgsql-performance>
Hi Mariel,
On 9/6/2017 4:38 AM, Mariel Cherkassky wrote:
> I'm sure that those tables arent involved in any other transaction
> when the loop is running. Anything else that I can check ? I think
> that mybe its connected to some fetching properties but Im not
> familiar with what settings..
That's the problem. There are a lot of things that can affect query
performance, but most of them _won't_ affect an open cursor unless
isolation is low and the query's source tables are changing due to
ongoing operations. Each time the cursor is accessed, the query's
source tables are checked for modifications, and if they have been
changed, the cursor's query is re-executed ... potentially changing the
result set.
Not that it matters here, but you didn't show your actual query. Even if
you are only fetching 100 rows, the query may be doing a lot of work
(joins, sorts, etc.) to identify those rows. If a complicated query is
being executed over and over due to ongoing table modifications ...
That's why I suggested using a temporary table that you know won't be
modified while the cursor is open on it - it's a way of side-stepping
isolation issues that are beyond your control.
If there really is no contention for the source tables, the only other
possibilities are a badly over-loaded (or mis-configured) server, a
problem with the storage system (e.g., a bad disk that is causing
hiccups rather than outright failures), or some unknown issue with the
extension you are using.
I'm afraid I'm out of suggestions.
George
view thread (10+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: printing results of query to file in different times
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox