From: | Aditya Toshniwal <aditya(dot)toshniwal(at)enterprisedb(dot)com> |
---|---|
To: | pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org> |
Subject: | Regarding multiple result set in query tool |
Date: | 2025-09-24 12:43:15 |
Message-ID: | CAM9w-_mQsC--AfLuEbv0NbW_p_b=PTD0ZbQr8J2Vv=2ioDp_gw@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgadmin-hackers |
Hi Dave/Hackers,
I'm working on a feature where the query tool will show separate data
output for all the select statements run in a single batch. psycopg does
provide the result sets (as libpq provides) but there is a catch. Let me
explain how pgAdmin currently works:
1. psycopg provides a cursor object on query execution.
2. The cursor object has a function called nextset which can be used to
move to the next result set of queries executed.
3. Once you move to the nextset, you cannot get data for the previous set.
It will only point to the current set.
4. Right now, we keep on looping through nextset until it reaches the last
set and then fetch the data from the last set (using pagination).
5. The fetched result is stored in client memory (python process)
So if we need to show the output of all the queries, we'll have to
fetch the result for each query and store it in python memory before moving
to the next set.
psycopg already stores the data on the client side, the only difference
will be that we'll store all sets and not just the last one.
If any one has any suggestions on memory management then please let me know.
Otherwise, I'm proceeding with what is discussed above.
Note: This will not be applicable for server cursors as it will against the
whole point of server cursor.
--
Thanks,
Aditya Toshniwal
pgAdmin Hacker | Sr. Staff SDE II | *enterprisedb.com*
<https://www.enterprisedb.com/>
"Don't Complain about Heat, Plant a TREE"
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Page | 2025-09-25 09:58:54 | Re: Regarding multiple result set in query tool |
Previous Message | Khushboo Vashi | 2025-09-04 11:01:25 | pgAdmin 4 v9.8 Released |