Re: Exposing the stats snapshot timestamp to SQL - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: Exposing the stats snapshot timestamp to SQL
Date
Msg-id 54CAC717.6000703@BlueTreble.com
Whole thread Raw
In response to Exposing the stats snapshot timestamp to SQL  (Matt Kelly <mkellycs@gmail.com>)
Responses Re: Exposing the stats snapshot timestamp to SQL
List pgsql-hackers
On 1/28/15 11:18 PM, Matt Kelly wrote:
> In a previous thread Tom Lane said:
>
>     (I'm also wondering if it'd make sense to expose the stats timestamp
>     as a callable function, so that the case could be dealt with
>     programmatically as well.  But that's future-feature territory.)
>
> (http://www.postgresql.org/message-id/27251.1421684169@sss.pgh.pa.us)
>
> It seemed the appropriate scope for my first submission, and that feature has been on my wish list for a while, so I
thoughtI'd grab it.
 

I've reviewed the patch (though haven't tested it myself) and it looks good. The only thing I'm not sure of is this:

+ /* Get the timestamp of the current statistics snapshot */
+ Datum
+ pg_stat_snapshot_timestamp(PG_FUNCTION_ARGS)
+ {
+     PG_RETURN_TIMESTAMPTZ(pgstat_fetch_global()->stats_timestamp);
+ }

Is the community OK with referencing stats_timestamp that way?
-- 
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com



pgsql-hackers by date:

Previous
From: Jim Nasby
Date:
Subject: Re: TABLESAMPLE patch
Next
From: David Steele
Date:
Subject: Re: pg_upgrade and rsync