Re: [PERFORM] Big IN() clauses etc : feature proposal

From: PFC <lists(at)peufeu(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PERFORM] Big IN() clauses etc : feature proposal
Date: 2006-05-10 19:23:59
Message-ID: op.s9cn5908cigqcu@apollo13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance


> Speaking of which, if a temp table is defined as ON COMMIT DROP or
> DELETE ROWS, there shouldn't be any need to store xmin/xmax, only
> cmin/cmax, correct?

Yes, that's that type of table I was thinking about...
You can't ROLLBACK a transaction on such a table.
You can however rollback a savepoint and use "INSERT INTO tmp SELECT FROM
tmp" which implies MVCC (I think ?)

I was suggesting to be able to use FETCH (from a cursor) in the same way
as SELECT, effectively using a named cursor (DECLARE...) as a simpler,
faster version of a temporary table, but there is another (better ?)
option :

If rowcount estimates for functions are implemented, then a set-returning
function can be written, which takes as argument a named cursor, and
returns its rows.
It would have accurate rowcount estimation (if the cursor is WITH SCROLL,
which is the case here, rows are stored, so we know their number).

Then you could do :

DECLARE my_cursor ... AS (query that we only want to do once)
SELECT ... FROM table1 JOIN fetch_cursor( my_cursor ) ON ...
SELECT ... FROM table2 JOIN fetch_cursor( my_cursor ) ON ...
SELECT ... FROM table3 JOIN fetch_cursor( my_cursor ) ON ...

No need to redefine the FETCH keyword.
An interesting functionalyty with minimal hassle.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2006-05-10 19:24:01 Re: [HACKERS] Big IN() clauses etc : feature proposal
Previous Message Jim C. Nasby 2006-05-10 19:06:17 Re: [HACKERS] Big IN() clauses etc : feature proposal

Browse pgsql-performance by date

  From Date Subject
Next Message Jim C. Nasby 2006-05-10 19:24:01 Re: [HACKERS] Big IN() clauses etc : feature proposal
Previous Message Jim C. Nasby 2006-05-10 19:06:17 Re: [HACKERS] Big IN() clauses etc : feature proposal