On Fri, Nov 23, 2018 at 1:54 AM Peter Eisentraut < peter.eisentr...@2ndquadrant.com> wrote:
> On 19/11/2018 06:18, Haribabu Kommi wrote: > > Amit suggested another option in another mail, so total viable > > solutions that are discussed as of now are, > > > > 1. Single API with NULL input treat as invalid value > > 2. Multiple API to deal with NULL input of other values > > 3. Single API with NULL value to treat them as current user, current > > database > > and NULL queryid. > > 4. Single API with -1 as invalid value, treat NULL as no matching. (Only > > problem > > with this approach is till now -1 is also a valid queryid, but setting > > -1 as queryid > > needs to be avoided. > > Can you show examples of what these would look like? > Following are some of the examples how the various options work. Option -1: select pg_stat_statements_reset(NULL,NULL,NULL); -- No change, just return. Because the function is strict. select pg_stat_statements_reset(10,10,NULL); -- Resets all the statements that are executed by userid 10 on database id 10. select pg_stat_statements_reset(NULL,10,NULL); -- Resets all the statements executed on database id 10 Option - 2: select pg_stat_statements_reset(NULL,NULL,NULL); -- No change, just return. Function are of type strict. select pg_stat_statements_reset(10,10,1234) -- Resets the query statement 1234 executed by userid 10 on database id 10 select pg_stat_statements_reset_by_userid(10) -- Resets all the statements executed by userid 10 select pg_stat_statements_reset_by_dbid(10); -- Rests all the statements executed on database id 10. select pg_stat_statements_reset_by_userid_and_dbid(10, 10); -- Resets all the statements executed by userid 10 on datbase id 10 Likewise total 7 API's. Option -3: select pg_stat_statements_reset(NULL,NULL,NULL); --Similar like option-1, but when the userid or databaseid are NULL, it uses the current_role and current_database as the options. But for the queryid when the options is NULL, it deletes all the queries. Rest of the details are same as option-1. Option -4: select pg_stat_statements_reset(NULL,NULL,NULL); -- No change, just return. Because the function is strict. select pg_stat_statements_reset(0,0,0); -- Resets all the statements select pg_stat_statements_reset(0,10,0); -- Resets all the statements executed on database id 10 select pg_stat_statements_reset(10,0,0); -- Resets all the statements executed on userid 10. Regards, Haribabu Kommi Fujitsu Australia