Incorrect stats_reset value in pg_stat_bgwriter - linux

I am checking the stats of background process by below command:
select * from pg_stat_bgwriter ;
But after resetting the stats by command:
select pg_stat_reset() ;
I am expecting the column stats_reset return the time at which stats reset, but it shows the very old time. Any idea or guidance on this ?
Example output:
checkpoints_timed | checkpoints_req | checkpoint_write_time |
checkpoint_sync_time | buffers_checkpoint | buffers_clean |
maxwritten_c lean | buffers_backend | buffers_backend_fsync |
buffers_alloc | stats_reset
-------------------+-----------------+-----------------------+----------------------+--------------------+---------------+-------------
-----+-----------------+-----------------------+---------------+-------------------------------
2525 | 9 | 193751796 | 322501 | 3162662 | 30839 | 176 | 451310 |
0 | 4120735 | 2016-09-27 08:32:43.638545-05
Thanks

Got the answer in the documentation : Doc- link
bgwriter is the shared among all the databases so it can be reset by different function by the below command:
pg_stat_reset_shared('bgwriter') ;

Related

Moving a split Vim window to the other half of the screen

Let's say we have 3 buffers (A, B, C) open in Vim arranged as follows
-----------------------------------------
| | |
| | |
| | |
| A | |
| | |
| | |
|------------------| B |
| | |
| | |
| C | |
| | |
| | |
-----------------------------------------
and we want to rearrange it as
-----------------------------------------
| | |
| | |
| | |
| | B |
| | |
| | |
| A |--------------------|
| | |
| | |
| | C |
| | |
| | |
-----------------------------------------
I know I can do this by closing C and reopening it after splitting B. Is there a simple way to do this where I don't have to close buffers and I can rearrange the windows directly?
You wouldn't "close" the buffer C, only the window that displays it.
Vim has dedicated normal mode commands for:
switching a window and the next one in a row or column,
rotating the whole window layout,
pushing a window to the far top, far right, far bottom, and far left,
but it doesn't have one for moving a window to an arbitrary point so, assuming the window you want to move has the focus, the command should look like this:
:q|winc w|sp c
which is not too shabby. You might be able to find a plugin that provides the level of control you are after on https://www.vim.org.

Merge Vertical Table to Horizontal table in Excel

I want to merge a vertical table to a horizontal table in excel with logics. I do not know where to start in excel. Any direction would be greatly appreciated.
Horizontal Table:
| Node | Volume | Disk Size | Disk Space Used |
| -------- | -------------- | --------- | --------------- |
| A | E:\ | 140.00GB | 138.22GB |
| A | C:\ | 119.90GB | 83.97GB |
Vertical Table:
| Node | CPU Count | CPU Load |
| -------- | ----------- | --------- |
| A | 8 | 1.43% |
The Table I wanted:
| Node | CPU Count | CPU Load | C Disk Size | C Disk Space Used | D Disk Size | C Disk Space Used |
| -------- | ----------- | --------- | ----------- | ----------------- | ----------- | ----------------- |
| A | 8 | 1.43% | 119.90GB | 138.22GB | 119.90GB | 83.97GB |
I don't use excel much. Any idea or advice in the direction of how to solve this would be great.
Is this even achievable in excel?
Thanks
I have solved, Vlookup function don't work in my case -(because Vlookup only can look up one field at a time). however, I got a workaround to archived something similar.
Merge the tables. excel merge table
Then use Pivot Table function.
thanks a million for the help.

sequence number for same text VBA macros

I am newbie in Macros VBA excel.
I am trying to write short code to display sequence number for same text VBA macros as shown in the screenshot. Please help me friends. I tried alot , some help will be really appreciated.
| Sequence | Subject |
|----------|---------|
| 1 | hello |
| 2 | hello |
| 3 | hello |
| 1 | Hi |
| 2 | Hi |
| 1 | come |
| 2 | come |
| 3 | come |
| 4 | come |
| 1 | go |

Find all occurrences from a string - Presto

I have the following as rows in HIVE (HDFS) and using Presto as the Query Engine.
1,#markbutcher72 #charlottegloyn Not what Belinda Carlisle thought. And yes, she was singing about Edgbaston.
2,#tomkingham #markbutcher72 #charlottegloyn It's true the garden of Eden is currently very green...
3,#MrRhysBenjamin #gasuperspark1 #markbutcher72 Actually it's Springfield Park, the (occasional) home of the might
The requirement is to do get the following through Presto Query. How can we get this please
1,markbutcher72
1,charlottegloyn
2,tomkingham
2,markbutcher72
2,charlottegloyn
3,MrRhysBenjamin
3,gasuperspark1
3,markbutcher72
select t.id
,u.token
from mytable as t
cross join unnest (regexp_extract_all(text,'(?<=#)\S+')) as u(token)
;
+----+----------------+
| id | token |
+----+----------------+
| 1 | markbutcher72 |
| 1 | charlottegloyn |
| 2 | tomkingham |
| 2 | markbutcher72 |
| 2 | charlottegloyn |
| 3 | MrRhysBenjamin |
| 3 | gasuperspark1 |
| 3 | markbutcher72 |
+----+----------------+

Write a command to increase or decrease the number of vertical splits

I usually have my Vim screen split into two vertical windows, each of which may be further horizontally split. Sometimes, I want to add or delete a vertical window. Is there a way to detect how many top-level vertical splits there are and add or remove vsplits as necessary?
For example, suppose my screen looks like this:
+--------+--------+
| | |
| | |
+--------+ |
| | |
| | |
| +--------+
| | |
+--------+--------+
I want :Columns 1 to give me
+--------+
| |
| |
+--------+
| |
| |
| |
| |
+--------+
by closing the two right-most windows.
I want :Columns 2 to do nothing, detecting that two columns are already open.
And I want :Columns 3 to give me
+--------+--------+--------+
| | | |
| | | |
+--------+ | |
| | | |
| | | |
| +--------+ |
| | | |
+--------+--------+--------+
I am fine if the function ignores vertical splits within horizontal splits. For example, if I had
+--------+
| |
| |
+---+----+
| | |
| | |
| | |
| | |
+---+----+
and I ran :Columns 2, I would get
+--------+--------+
| | |
| | |
+---+----+ |
| | | |
| | | |
| | | |
| | | |
+---+----+--------+
There is indeed a way, but it is involved; the first step is to count the currently-open vertical windows, and I don’t know of any built-in function that facilitates this. The working approach I found to it is basically to start at the first window (the top of the first — if not the entirety of the first — vertical split), and to then, using wincmd l, move to the next window to the right for as long as wincmd l moves to a new window, adding each to a count of open vertical windows including the first one. (I think this is what Gary Fixler referred to in the comments on the question.)
I started trying to write the code for posting here, and it grew to become larger than any function I would want to put in my ~/.vimrc, so I ended up turning it into a plugin which takes the above approach and provides the :Columns command; see Columcille (on vim.org at http://www.vim.org/scripts/script.php?script_id=4742.) The plugin also provides a command for similarly managing horizontal split windows: :Rows divides the current column (or the main window, if there are no open vertical splits) into the specified number of “rows.”

Resources