Subject: pgAdmin 4 commit: Cleanup handling of default/null values when data edi

From: Dave Page <[email-masked]>
Date: Sat, 27 May 2017 18:51:07 +0000

Cleanup handling of default/null values when data editting. FIxes #2400

Branch
------
master

Details
-------
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=1f26953504a963d2c2223c51f9da29db4d48594b
Author: Surinder Kumar <[email-masked]>

Modified Files
--------------
.../static/js/slickgrid/slick.pgadmin.editors.js   |  58 ++++-
web/pgadmin/tools/sqleditor/command.py             |   5 +
.../sqleditor/templates/sqleditor/js/sqleditor.js  | 254 ++++++++++++---------
3 files changed, 205 insertions(+), 112 deletions(-)

-- 
Sent via pgadmin-hackers mailing list ([email-masked])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

---

From: Harshal Dhumal <[email-masked]>
Date: Sun, 28 May 2017 22:55:56 +0530

Hi,

This commit has some performance issues with row paste functionality.
For 2K copied rows with 3 columns (2 integer and one null column) it took
near about 10 seconds to complete paste operation. And entire application
becomes unresponsive for those 10 seconds.

This is mainly because for each single pasted row entire grid is
re-rendered ( is what I see in code).
Ideally grid should be re-rendered only once after all rows are provided to
grid.

below code snippet from _paste_rows function

_.each(copied_rows, function(row) {
    var new_row = arr_to_object(row);
    new_row.is_row_copied = true;
    row = new_row;
    self.temp_new_rows.push(count);
    grid.onAddNewRow.notify(
      {item: new_row, column: self.columns[0] , grid:grid}
    )
    grid.setSelectedRows([]);
    count++;
});

The statement

grid.onAddNewRow.notify(
      {item: new_row, column: self.columns[0] , grid:grid}
    )

causes grid to re-render (as we listener on onAddNewRow event where we
re-render the grid)

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

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

---

From: Dave Page <[email-masked]>
Date: Sun, 28 May 2017 19:49:25 -0400

On Sun, May 28, 2017 at 1:25 PM, Harshal Dhumal
<[email-masked]> wrote:
> This is mainly because for each single pasted row entire grid is re-rendered
> ( is what I see in code).

Copying that number of rows is an extreme case of course, but still...
Is there an alternative way to batch notify?

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

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

---

From: Surinder Kumar <[email-masked]>
Date: Mon, 29 May 2017 11:38:36 +0530

Hi Dave,

The grid was being re-rendered after add new row and copy/paste to add a
blank row in the end of grid, but in case of copy/paste batch operation it
should run once, so that code is moved out of addNewRow(...) and put into a
function grid.addBlankRow() and called separately for copy/paste after
batch operation is completed.

Now copy/paste with 10k records took 2 seconds.

Please find attached patch.

---

From: Dave Page <[email-masked]>
Date: Tue, 30 May 2017 16:22:28 +0100

Thanks, applied.

On Mon, May 29, 2017 at 7:08 AM, Surinder Kumar
<[email-masked]> wrote:
> function grid.addBlankRow() and called separately for copy/paste after batch
> operation is completed.
>