Re: [RM2522] Improve grid/column select all operation

From: Harshal Dhumal <harshal(dot)dhumal(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: Murtuza Zabuawala <murtuza(dot)zabuawala(at)enterprisedb(dot)com>, pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [RM2522] Improve grid/column select all operation
Date: 2017-06-30 08:39:11
Message-ID: CAFiP3vzS4xivuBzg1DkK_rEtdFWKrVNFMOnsTzRJ9PUVBnunuQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi,

This patch is not related to improve copy/past operation. It's only related
to grid selection.
The improvement is only between when user clicks on grid select all column
to until all row are selected (turned into blue). With large columns though
improvement is not large but it not putting any overhead. Other hand with
less columns but large row count the improvement it quite noticeable. Code
change is only single line to use array concatenation instead of underscore
union <http://underscorejs.org/#union>. I had look at union function
implementation. It first flattens result set recursively and then removes
duplicate which is not required in our case. All we want is indexes of
complete rows in selected rows (ranges).

--
*Harshal Dhumal*
*Sr. Software Engineer*

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Fri, Jun 30, 2017 at 1:30 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:

>
>
> On Fri, Jun 30, 2017 at 8:57 AM, Murtuza Zabuawala <murtuza.zabuawala@
> enterprisedb.com> wrote:
>
>> I guess so, number of columns do have overhead on selection & copy/paste
>> operation because of arbitrary copy paste feature, now we have to scan
>> start cell (first selected cell) & end cell (last selected cell) for each
>> row, In old code we were selecting complete row which was fast but now user
>> can select different columns as well, so we have scan for each selected
>> columns.
>>
>
> Yeah, but 14 - 15 seconds for 100K rows? It takes a fraction of that time
> to find them in the database, return the results to the pgAdmin server, and
> render them.
>
> We should be able to generate a CSV representation of all the selected
> fields in far less time.
>
>
>>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> On Fri, Jun 30, 2017 at 12:07 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
>>
>>> Hi
>>>
>>> On Thursday, June 29, 2017, Harshal Dhumal <
>>> harshal(dot)dhumal(at)enterprisedb(dot)com> wrote:
>>>
>>>>
>>>>
>>>> On Thu, Jun 29, 2017 at 4:33 PM, Harshal Dhumal <
>>>> harshal(dot)dhumal(at)enterprisedb(dot)com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Please find attached patch for RM2522.
>>>>>
>>>>> With this patch grid/column select all time is reduce to ~1 second
>>>>> from 8-10 seconds.
>>>>>
>>>> This benchmarking is performed with 100k rows and 2 columns (int, text).
>>>>
>>>
>>> I see very little improvement (~15s to 14s). My test case has 108786
>>> rows in it, and is generated from the query:
>>>
>>> select * from pg_class c, pg_attribute a where c.oid = a.attrelid
>>> union all
>>> select * from pg_class c, pg_attribute a where c.oid = a.attrelid
>>> union all
>>> select * from pg_class c, pg_attribute a where c.oid = a.attrelid
>>> union all
>>> select * from pg_class c, pg_attribute a where c.oid = a.attrelid
>>>
>>> Maybe the number of columns has something to do with it?
>>>
>>> AND... I'm still left with nothing being copied to the clipboard (the
>>> main issue by the way, which no patch for this so far seems to have
>>> tackled).
>>>
>>> Thanks.
>>>
>>>
>>>>
>>>>
>>>>>
>>>>> The solution was to use simple array concatenation instead of
>>>>> underscore union while getting index of all selected complete rows.
>>>>> Underscore union function is only useful when user selects different
>>>>> ranges from grid and those ranges overlaps. In this case union function
>>>>> removes duplicate (overlapped) rows.
>>>>> However result grid in sqleditor do not support overlapped row
>>>>> selection so we can simply cancat rows from different ranges without
>>>>> worrying about overlapped row selection.
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Harshal Dhumal*
>>>>> *Sr. Software Engineer*
>>>>>
>>>>> EnterpriseDB India: http://www.enterprisedb.com
>>>>> The Enterprise PostgreSQL Company
>>>>>
>>>>
>>>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>>
>>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2017-06-30 08:54:35 pgAdmin 4 commit: Improve speed of Select All in the results grid. Fixe
Previous Message Dave Page 2017-06-30 08:00:46 Re: [RM2522] Improve grid/column select all operation