Re: New SQL counter statistics view (pg_stat_sql)

From: vinayak <Pokale_Vinayak_q3(at)lab(dot)ntt(dot)co(dot)jp>
To: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: New SQL counter statistics view (pg_stat_sql)
Date: 2016-10-17 05:35:39
Message-ID: 4f6ce333-4ba3-c1d7-7276-4507b23dd4c1@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2016/10/17 10:22, Haribabu Kommi wrote:
>
>
> On Fri, Oct 14, 2016 at 7:48 PM, vinayak
> <Pokale_Vinayak_q3(at)lab(dot)ntt(dot)co(dot)jp
> <mailto:Pokale_Vinayak_q3(at)lab(dot)ntt(dot)co(dot)jp>> wrote:
>
>
> On 2016/10/12 12:21, Haribabu Kommi wrote:
>> I tried changing the pg_stat_sql into row mode and ran the
>> regress suite to
>> add different type of SQL commands to the view and ran the
>> pgbench test
>> on my laptop to find out any performance impact with this patch.
>>
>> HEAD PATCH
>> pgbench - select 828 816
>>
>> Here I attached the pg_stat_sql patch to keep track of all SQL
>> commands
>> based on the commandTag and their counts. I attached the result
>> of this
>> view that is run on the database after "make installcheck" just
>> for reference.
> Some comments:
> I think we can use pgstat_* instead of pgstat* for code consistency.
>
> +static HTAB *pgStatBackendSql = NULL;
> How about *pgstat_backend_sql
>
> +HTAB *pgStatSql = NULL;
> How about *pgstat_sql
>
>
> Changed.
>
> +static void pgstat_recv_sqlstmt(PgStat_MsgSqlstmt * msg, int len);
> How about PgStat_MsgSqlstmt *msg instead of PgStat_MsgSqlstmt * msg
>
>
> Added the typdef into typdef.list file so this problem never occurs.
>
> +typedef struct PgStatSqlstmtEntry
> How about PgStat_SqlstmtEntry
>
> +typedef struct PgStatMsgSqlstmt
> How about PgStat_MsgSqlstmt
>
>
>
> changed.
>
> Updated patch is attached.
The updated patch gives following error.
Error:
../../../../src/include/pgstat.h:557: error: ‘PgStatSqlstmtEntry’
undeclared here (not in a function)

- ((PGSTAT_MSG_PAYLOAD - sizeof(int)) / sizeof(PgStatSqlstmtEntry))
+ ((PGSTAT_MSG_PAYLOAD - sizeof(int)) / sizeof(PgStat_SqlstmtEntry))
The attached patch fixed the error.

Regards,
Vinayak Pokale

Attachment Content-Type Size
pg_stat_sql_row_mode_2.patch application/x-download 26.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2016-10-17 05:37:05 Re: pg_basebackup stream xlog to tar
Previous Message Dilip Kumar 2016-10-17 05:23:28 Re: Parallel bitmap heap scan