powa-team / powa

PostgreSQL Workload Analyzer
http://powa.readthedocs.io/
PostgreSQL License
768 stars 57 forks source link

Filled graphs are broken #2

Closed marco44 closed 10 years ago

marco44 commented 10 years ago

The filling is bogous, it seems to be filled by top instead of bottom.

marco44 commented 10 years ago

This problem comes from the function powa_getstatdata_sample_db(), which returns different values for a same timestamp. These different values cause the display problem.

Example: (postgres@127.0.0.1:5435) [powa] > select (extract(epoch from ts)*1000)::bigint,ts,total_calls from powa_getstatdata_sample_db(now() - interval '5 hours',now()-interval '4 hours','powa',30) order by 1; int8 | ts | total_calls ---------------+-------------------------------+------------- 1396446090637 | 2014-04-02 15:41:30.636533+02 | 246 1396446090637 | 2014-04-02 15:41:30.636533+02 | 0 1396446100640 | 2014-04-02 15:41:40.64013+02 | 247 1396446100640 | 2014-04-02 15:41:40.64013+02 | 0 1396446110648 | 2014-04-02 15:41:50.648228+02 | 248 1396446110648 | 2014-04-02 15:41:50.648228+02 | 0 1396446120657 | 2014-04-02 15:42:00.657292+02 | 249 1396446120657 | 2014-04-02 15:42:00.657292+02 | 0 1396446130667 | 2014-04-02 15:42:10.666813+02 | 250 1396446130667 | 2014-04-02 15:42:10.666813+02 | 0 1396446140674 | 2014-04-02 15:42:20.674325+02 | 251 1396446140674 | 2014-04-02 15:42:20.674325+02 | 1 1396446150674 | 2014-04-02 15:42:30.674279+02 | 0 1396446150674 | 2014-04-02 15:42:30.674279+02 | 0 1396446160684 | 2014-04-02 15:42:40.684201+02 | 253 (15 rows)

marco44 commented 10 years ago

There is still an issue, when we requests more lines than the servers has collected, leading to erroneous first two rows.

For instance, asking for less rows than collected is fine, every ts are different:

(postgres@127.0.0.1:5435) [powa] > select (extract(epoch from ts)*1000)::bigint,ts,total_calls from powa_getstatdata_sample_db(now() - interval '1 hours',now(),'powa',10) order by 1; int8 | ts | total_calls ---------------+-------------------------------+------------- 1396968615061 | 2014-04-08 16:50:15.060883+02 | 4 1396968655085 | 2014-04-08 16:50:55.08514+02 | 4 1396968695120 | 2014-04-08 16:51:35.119769+02 | 10 1396968735149 | 2014-04-08 16:52:15.149+02 | 174 1396968775180 | 2014-04-08 16:52:55.179952+02 | 22 1396968815212 | 2014-04-08 16:53:35.211715+02 | 37 1396968855239 | 2014-04-08 16:54:15.23924+02 | 5 1396968895275 | 2014-04-08 16:54:55.274652+02 | 24 1396968935313 | 2014-04-08 16:55:35.312817+02 | 19 1396968975341 | 2014-04-08 16:56:15.341441+02 | 4 1396969015379 | 2014-04-08 16:56:55.378967+02 | 4 (11 rows)

But asking for more rows than the servers can produce :

(postgres@127.0.0.1:5435) [powa] > select (extract(epoch from ts)*1000)::bigint,ts,total_calls from powa_getstatdata_sample_db(now() - interval '1 hours',now(),'powa',100) order by 1; int8 | ts | total_calls ---------------+-------------------------------+------------- 1396968595043 | 2014-04-08 16:49:55.042949+02 | 1 1396968595043 | 2014-04-08 16:49:55.043253+02 | 1 1396968605052 | 2014-04-08 16:50:05.052419+02 | 1 1396968615061 | 2014-04-08 16:50:15.060883+02 | 1 1396968625067 | 2014-04-08 16:50:25.066527+02 | 1 1396968635073 | 2014-04-08 16:50:35.07281+02 | 1 1396968645076 | 2014-04-08 16:50:45.075621+02 | 1 1396968655085 | 2014-04-08 16:50:55.08514+02 | 1 1396968665095 | 2014-04-08 16:51:05.094901+02 | 1 1396968675104 | 2014-04-08 16:51:15.103965+02 | 1 1396968685111 | 2014-04-08 16:51:25.110512+02 | 1 1396968695120 | 2014-04-08 16:51:35.119769+02 | 1 1396968705129 | 2014-04-08 16:51:45.129389+02 | 1 1396968715139 | 2014-04-08 16:51:55.138521+02 | 1 1396968725148 | 2014-04-08 16:52:05.148021+02 | 7 1396968735149 | 2014-04-08 16:52:15.149+02 | 49 1396968745154 | 2014-04-08 16:52:25.154496+02 | 61 1396968755164 | 2014-04-08 16:52:35.164103+02 | 27 1396968765171 | 2014-04-08 16:52:45.170521+02 | 37 1396968775180 | 2014-04-08 16:52:55.179952+02 | 19 1396968785186 | 2014-04-08 16:53:05.185784+02 | 1 1396968795194 | 2014-04-08 16:53:15.193806+02 | 1 1396968805203 | 2014-04-08 16:53:25.202514+02 | 1 1396968815212 | 2014-04-08 16:53:35.211715+02 | 1 1396968825221 | 2014-04-08 16:53:45.22101+02 | 1 1396968835227 | 2014-04-08 16:53:55.226653+02 | 16 1396968845230 | 2014-04-08 16:54:05.230187+02 | 19 1396968855239 | 2014-04-08 16:54:15.23924+02 | 1 1396968865248 | 2014-04-08 16:54:25.248099+02 | 1 1396968875257 | 2014-04-08 16:54:35.257447+02 | 1 1396968885267 | 2014-04-08 16:54:45.266508+02 | 2 1396968895275 | 2014-04-08 16:54:55.274652+02 | 6 1396968905284 | 2014-04-08 16:55:05.284087+02 | 6 1396968915294 | 2014-04-08 16:55:15.29363+02 | 11 1396968925303 | 2014-04-08 16:55:25.303047+02 | 1 1396968935313 | 2014-04-08 16:55:35.312817+02 | 6 1396968945314 | 2014-04-08 16:55:45.314008+02 | 1 1396968955323 | 2014-04-08 16:55:55.323211+02 | 11 1396968965333 | 2014-04-08 16:56:05.332569+02 | 1 1396968975341 | 2014-04-08 16:56:15.341441+02 | 1 1396968985350 | 2014-04-08 16:56:25.350473+02 | 1 1396968995360 | 2014-04-08 16:56:35.360196+02 | 1 1396969005370 | 2014-04-08 16:56:45.369519+02 | 1 1396969015379 | 2014-04-08 16:56:55.378967+02 | 1 1396969025388 | 2014-04-08 16:57:05.388197+02 | 1 1396969035397 | 2014-04-08 16:57:15.39749+02 | 1 1396969045401 | 2014-04-08 16:57:25.401304+02 | 1 1396969055407 | 2014-04-08 16:57:35.40652+02 | 1 1396969065416 | 2014-04-08 16:57:45.415997+02 | 1 1396969075426 | 2014-04-08 16:57:55.425868+02 | 1 1396969085436 | 2014-04-08 16:58:05.435629+02 | 6 1396969095438 | 2014-04-08 16:58:15.437596+02 | 1 1396969105447 | 2014-04-08 16:58:25.447205+02 | 1 1396969115457 | 2014-04-08 16:58:35.457093+02 | 1 (54 rows)

marco44 commented 10 years ago

Indeed, the first two rows have different timestamps, but the same second. I will add a group by and aggregate on the UI part to solve this issue.

The extension part is solved.