Re: Regarding multiple result set in query tool

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Aditya Toshniwal <aditya(dot)toshniwal(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: Regarding multiple result set in query tool
Date: 2025-09-29 09:07:07
Message-ID: CA+OCxoymsJMs-9-epnEHXe95W+4dFB4Y=C9TL_a_PPSmBXnzgw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

On Mon, 29 Sept 2025 at 10:01, Aditya Toshniwal <
aditya(dot)toshniwal(at)enterprisedb(dot)com> wrote:

> Hi,
>
> I raised this to the psycopg team and we may possibly not need to take
> care of anything on the pgAdmin side. Check the discussion here -
> https://github.com/psycopg/psycopg/discussions/1170
>

Well that seems ideal - and Daniele seems quite open to the idea which is
good news :-)

>
> But, I will have to raise a PR to get some extra functions for our
> use-case.
>
> On Mon, Sep 29, 2025 at 11:23 AM Aditya Toshniwal <
> aditya(dot)toshniwal(at)enterprisedb(dot)com> wrote:
>
>> Hi Dave,
>>
>> On Thu, Sep 25, 2025 at 7:55 PM Dave Page <dpage(at)pgadmin(dot)org> wrote:
>>
>>>
>>>
>>> On Thu, 25 Sept 2025 at 14:44, Aditya Toshniwal <
>>> aditya(dot)toshniwal(at)enterprisedb(dot)com> wrote:
>>>
>>>> Hi Dave,
>>>>
>>>>>
>>>>> If pgAdmin were a single-user application, I'd agree - however it is
>>>>> not when running in server mode. Other users will not know what is going on
>>>>> if one user exhausts memory.
>>>>>
>>>> How about allowing multi result sets only for desktop app?
>>>>
>>>
>>> I *really* dislike that. We should support all features in both modes,
>>> except where it clearly doesn't make sense.
>>>
>>>
>>>> The problem with memory limits is - it's an extra overhead to keep
>>>> checking how much memory is consumed. A row size will depend on the number
>>>> of columns and data. If we have a predefined algorithm which will decide
>>>> the limits in a performant way is desirable.
>>>>
>>>
>>> Well we can take the extra cycles to compute actual memory usage, or we
>>> can just pick an arbitrary number of rows (which as you note, will depend
>>> on the schema and data). The former is clearly easier to tune - it could be
>>> an arbitrary limit in the config, or it could be computed based on machine
>>> resources and utilisation, whilst the latter is always going to be a guess.
>>> I'm not sure I see another way. Anyone else?
>>>
>> For the first approach - python provides a function which we can use. But
>> deciding the limit is something tricky. A user may still get out of memory
>> error with a limit set. It will all depend on what is running on his
>> system. Setting the limit itself is like playing a video game. For the row
>> count based limit, we already have a per page limit - and adding more such
>> configs will only add more confusion.
>>
>> import sys
>>
>> my_tuple = (1, 2, 'hello', 4.5)
>> memory_size = sys.getsizeof(my_tuple)
>> print(f"The memory size of the tuple is: {memory_size} bytes")
>>
>>
>>> --
>>> Dave Page
>>> pgAdmin: https://www.pgadmin.org
>>> PostgreSQL: https://www.postgresql.org
>>> pgEdge: https://www.pgedge.com
>>>
>>>
>>
>> --
>> Thanks,
>> Aditya Toshniwal
>> pgAdmin Hacker | Sr. Staff SDE II | *enterprisedb.com*
>> <https://www.enterprisedb.com/>
>> "Don't Complain about Heat, Plant a TREE"
>>
>
>
> --
> Thanks,
> Aditya Toshniwal
> pgAdmin Hacker | Sr. Staff SDE II | *enterprisedb.com*
> <https://www.enterprisedb.com/>
> "Don't Complain about Heat, Plant a TREE"
>

--
Dave Page
pgAdmin: https://www.pgadmin.org
PostgreSQL: https://www.postgresql.org
pgEdge: https://www.pgedge.com

In response to

Browse pgadmin-hackers by date

  From Date Subject
Next Message Akshay Joshi 2025-09-29 13:57:23 Regarding feature "Option to skip Password-Dialog for identity file"
Previous Message Aditya Toshniwal 2025-09-29 09:01:31 Re: Regarding multiple result set in query tool