public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables
6+ messages / 3 participants
[nested] [flat]

* [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables
@ 2019-01-17 06:05 Khushboo Vashi <[email protected]>
  2019-01-21 11:12 ` Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Khushboo Vashi @ 2019-01-17 06:05 UTC (permalink / raw)
  To: pgadmin-hackers

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


Attachments:

  [application/octet-stream] RM_3664.patch (2.0K, 3-RM_3664.patch)
  download | inline diff:
diff --git a/web/pgadmin/misc/statistics/static/js/statistics.js b/web/pgadmin/misc/statistics/static/js/statistics.js
index cfd573e1..d01d5c15 100644
--- a/web/pgadmin/misc/statistics/static/js/statistics.js
+++ b/web/pgadmin/misc/statistics/static/js/statistics.js
@@ -117,7 +117,7 @@ define('misc.statistics', [
       _.bindAll(
         this,
         'showStatistics', 'panelVisibilityChanged',
-        '__createMultiLineStatistics', '__createSingleLineStatistics');
+        '__createMultiLineStatistics', '__createSingleLineStatistics', '__loadMoreRows');
 
       _.extend(
         this, {
@@ -253,10 +253,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 +398,14 @@ define('misc.statistics', [
 
       }
 
-      this.collection.reset(rows);
+      this.collection.reset(rows.splice(0, 50));
+    },
+
+    __loadMoreRows: function(data, prettifyFields) {
+      var rows = this.data['rows'];
+        if (rows.length > 0) {
+          this.collection.add(rows.splice(0, 50));
+        }
     },
 
     __createSingleLineStatistics: function(data, prettifyFields) {


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables
  2019-01-17 06:05 [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Khushboo Vashi <[email protected]>
@ 2019-01-21 11:12 ` Akshay Joshi <[email protected]>
  2019-01-22 11:35   ` Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Aditya Toshniwal <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Akshay Joshi @ 2019-01-21 11:12 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers

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*


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables
  2019-01-17 06:05 [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Khushboo Vashi <[email protected]>
  2019-01-21 11:12 ` Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Akshay Joshi <[email protected]>
@ 2019-01-22 11:35   ` Aditya Toshniwal <[email protected]>
  2019-01-29 09:47     ` Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Khushboo Vashi <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Aditya Toshniwal @ 2019-01-22 11:35 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: pgadmin-hackers

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"


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables
  2019-01-17 06:05 [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Khushboo Vashi <[email protected]>
  2019-01-21 11:12 ` Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Akshay Joshi <[email protected]>
  2019-01-22 11:35   ` Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Aditya Toshniwal <[email protected]>
@ 2019-01-29 09:47     ` Khushboo Vashi <[email protected]>
  2019-01-31 08:56       ` Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Aditya Toshniwal <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Khushboo Vashi @ 2019-01-29 09:47 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; +Cc: Akshay Joshi <[email protected]>; pgadmin-hackers

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) {


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables
  2019-01-17 06:05 [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Khushboo Vashi <[email protected]>
  2019-01-21 11:12 ` Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Akshay Joshi <[email protected]>
  2019-01-22 11:35   ` Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Aditya Toshniwal <[email protected]>
  2019-01-29 09:47     ` Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Khushboo Vashi <[email protected]>
@ 2019-01-31 08:56       ` Aditya Toshniwal <[email protected]>
  2019-01-31 09:27         ` Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Aditya Toshniwal @ 2019-01-31 08:56 UTC (permalink / raw)
  To: Khushboo Vashi <[email protected]>; +Cc: Akshay Joshi <[email protected]>; pgadmin-hackers

Hi Khushboo,

The patch looks good to me and statistics works great now. Tested with 2000
tables.
However, I did not get what did the below change do.

*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,

     }

   );



@Committer,

Except above change, all looks good to me.



On Tue, Jan 29, 2019 at 3:17 PM Khushboo Vashi <
[email protected]> wrote:

> 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"
>>
>

-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB Software Solutions | Pune
"Don't Complain about Heat, Plant a tree"


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables
  2019-01-17 06:05 [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Khushboo Vashi <[email protected]>
  2019-01-21 11:12 ` Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Akshay Joshi <[email protected]>
  2019-01-22 11:35   ` Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Aditya Toshniwal <[email protected]>
  2019-01-29 09:47     ` Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Khushboo Vashi <[email protected]>
  2019-01-31 08:56       ` Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Aditya Toshniwal <[email protected]>
@ 2019-01-31 09:27         ` Akshay Joshi <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Akshay Joshi @ 2019-01-31 09:27 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; +Cc: Khushboo Vashi <[email protected]>; pgadmin-hackers

Thanks patch applied with the mentioned changes.

On Thu, Jan 31, 2019 at 2:26 PM Aditya Toshniwal <
[email protected]> wrote:

> Hi Khushboo,
>
> The patch looks good to me and statistics works great now. Tested with
> 2000 tables.
> However, I did not get what did the below change do.
>
> *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,
>
>      }
>
>    );
>
>
>
> @Committer,
>
> Except above change, all looks good to me.
>
>
>
> On Tue, Jan 29, 2019 at 3:17 PM Khushboo Vashi <
> [email protected]> wrote:
>
>> 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"
>>>
>>
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Software Engineer | EnterpriseDB Software Solutions | Pune
> "Don't Complain about Heat, Plant a tree"
>


-- 
*Akshay Joshi*

*Sr. Software Architect *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2019-01-31 09:27 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-01-17 06:05 [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables Khushboo Vashi <[email protected]>
2019-01-21 11:12 ` Akshay Joshi <[email protected]>
2019-01-22 11:35   ` Aditya Toshniwal <[email protected]>
2019-01-29 09:47     ` Khushboo Vashi <[email protected]>
2019-01-31 08:56       ` Aditya Toshniwal <[email protected]>
2019-01-31 09:27         ` Akshay Joshi <[email protected]>

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