Re: CURSOR slowes down a WHERE clause 100 times? - Mailing list pgsql-performance

From Tom Lane
Subject Re: CURSOR slowes down a WHERE clause 100 times?
Date
Msg-id 7484.1120744773@sss.pgh.pa.us
Whole thread Raw
In response to Re: CURSOR slowes down a WHERE clause 100 times?  (Niccolo Rigacci <niccolo@rigacci.org>)
List pgsql-performance
Niccolo Rigacci <niccolo@rigacci.org> writes:
> How can I EXPLAIN ANALYZE a cursor like this?

>   BEGIN;
>   DECLARE mycursor BINARY CURSOR FOR
>     SELECT ...
>   FETCH ALL IN mycursor;
>   END;

> I tried to put EXPLAIN ANALYZE in front of the SELECT and in
> front of the FETCH, but I got two "syntax error"...

Just FYI, you can't EXPLAIN ANALYZE this, but you can EXPLAIN it:

    EXPLAIN DECLARE x CURSOR FOR ...

so you can at least find out what the plan is.

It might be cool to support EXPLAIN ANALYZE FETCH --- not sure what that
would take.

            regards, tom lane

pgsql-performance by date:

Previous
From: Dawid Kuroczko
Date:
Subject: Re: Surprizing performances for Postgres on Centrino
Next
From: Tom Lane
Date:
Subject: Re: How to speed up delete