public inbox for [email protected]  
help / color / mirror / Atom feed
From: Khushboo Vashi <[email protected]>
To: Aditya Toshniwal <[email protected]>
Cc: Akshay Joshi <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables
Date: Tue, 29 Jan 2019 15:17:05 +0530
Message-ID: <CAFOhELfq7sHRHF+7-+B-1DOmNHowD8519tMLcbLTdG0FL24j1w@mail.gmail.com> (raw)
In-Reply-To: <CAM9w-_n2QyyXyqcYFXAuDO6LKVyL9HxsMEJXqZD9KY_q+M-wPg@mail.gmail.com>
References: <CAFOhELfJZCeQ2tE3_H7vUXQJ2uk6PF0u=wgoy494OUtX=UDjHQ@mail.gmail.com>
	<CANxoLDfmzYraqtBo3cTdBctV2jq0-vcBMUSKOho+e6Myu2Yvfw@mail.gmail.com>
	<CAM9w-_n2QyyXyqcYFXAuDO6LKVyL9HxsMEJXqZD9KY_q+M-wPg@mail.gmail.com>

Hi,

Please find the attached updated patch.
I have also improved the performance of the properties tab.
Please also apply the bootstrap toggle patch to check the properties tab
performance.

Thanks,
Khushboo

On Tue, Jan 22, 2019 at 5:05 PM Aditya Toshniwal <
[email protected]> wrote:

> Hi Khushboo,
>
> There is improvement than before but the UI still lags. I tested with 2000
> tables and statistics on Tables node.
> I would also suggest to add further rows only if scrolling down. Rows
> adding can be avoided even if the scroll does not take to the last element.
> Currently, if I scroll slightly down it add rows and if I scroll back up
> it adds more. I think the scroll up fetch can be avoided.
>
> On Mon, Jan 21, 2019 at 4:43 PM Akshay Joshi <
> [email protected]> wrote:
>
>> Hi Aditya
>>
>> Can you please review it.
>>
>> On Thu, Jan 17, 2019 at 11:36 AM Khushboo Vashi <
>> [email protected]> wrote:
>>
>>> Hi,
>>>
>>> Please find the attached patch to fix the RM 3664 - Statistic panel
>>> hangs when 1000+ tables
>>>
>>> The statistics tab hangs with more rows. So, now the rows will be pushed
>>> in the backgrid collection in bunches on scroll event to fix this issue.
>>>
>>> Thanks,
>>> Khushboo
>>>
>>
>>
>> --
>> *Akshay Joshi*
>>
>> *Sr. Software Architect *
>>
>>
>>
>> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>>
>
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Software Engineer | EnterpriseDB Software Solutions | Pune
> "Don't Complain about Heat, Plant a tree"
>


Attachments:

  [application/octet-stream] RM_3664_v1.patch (3.0K, 3-RM_3664_v1.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/static/js/collection.js b/web/pgadmin/browser/static/js/collection.js
index aa758afd..6722b7c5 100644
--- a/web/pgadmin/browser/static/js/collection.js
+++ b/web/pgadmin/browser/static/js/collection.js
@@ -188,7 +188,7 @@ define([
           'remove': function() {
             if (this.grid) {
               if (this.grid.collection) {
-                this.grid.collection.reset(null, {silent: true});
+                this.grid.collection.reset({silent: true});
                 delete (this.grid.collection);
               }
               delete (this.grid);
diff --git a/web/pgadmin/misc/statistics/static/js/statistics.js b/web/pgadmin/misc/statistics/static/js/statistics.js
index cfd573e1..5441f883 100644
--- a/web/pgadmin/misc/statistics/static/js/statistics.js
+++ b/web/pgadmin/misc/statistics/static/js/statistics.js
@@ -104,7 +104,9 @@ define('misc.statistics', [
       offText: gettext('False'),
       onColor: 'success',
       offColor: 'primary',
-      size: 'mini',
+      size: 'small',
+      width: null,
+      height: null,
     }
   );
 
@@ -117,7 +119,7 @@ define('misc.statistics', [
       _.bindAll(
         this,
         'showStatistics', 'panelVisibilityChanged',
-        '__createMultiLineStatistics', '__createSingleLineStatistics');
+        '__createMultiLineStatistics', '__createSingleLineStatistics', '__loadMoreRows');
 
       _.extend(
         this, {
@@ -253,10 +255,22 @@ define('misc.statistics', [
             clearTimeout(timer);
             $msgContainer.text('');
             if (res.data) {
-              var data = res.data;
+              var data = self.data = res.data;
               if (node.hasCollectiveStatistics || data['rows'].length > 1) {
+                // Listen scroll event to load more rows
+                pgBrowser.Events.on(
+                  'pgadmin-browser:panel-statistics:' +
+                  wcDocker.EVENT.SCROLLED,
+                  self.__loadMoreRows
+                );
                 self.__createMultiLineStatistics.call(self, data, node.statsPrettifyFields);
               } else {
+                // Do not listen the scroll event
+                pgBrowser.Events.off(
+                  'pgadmin-browser:panel-statistics:' +
+                  wcDocker.EVENT.SCROLLED,
+                  self.__loadMoreRows
+                );
                 self.__createSingleLineStatistics.call(self, data, node.statsPrettifyFields);
               }
 
@@ -386,7 +400,17 @@ define('misc.statistics', [
 
       }
 
-      this.collection.reset(rows);
+      this.collection.reset(rows.splice(0, 50));
+    },
+
+    __loadMoreRows: function() {
+      let elem = $('.pg-panel-statistics-container').closest('.wcFrameCenter')[0];
+      if ((elem.scrollHeight - 10) < elem.scrollTop + elem.offsetHeight) {
+        var rows = this.data['rows'];
+        if (rows.length > 0) {
+          this.collection.add(rows.splice(0, 50));
+        }
+      }
     },
 
     __createSingleLineStatistics: function(data, prettifyFields) {


view thread (6+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables
  In-Reply-To: <CAFOhELfq7sHRHF+7-+B-1DOmNHowD8519tMLcbLTdG0FL24j1w@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox