Azure Postgresql Flexi instance - How to check the table creation date and time

subhash-DBA 45 Reputation points


Can someone help me to find the tables/objects create date/time in Azure postgresql flexi instance ?

we used to use this one , select * from pg_stat_file( pg_relation_filepath('alert') ) in on-prem but that's not working in azure with admin user due to permission issues

Azure Database for PostgreSQL
{count} votes

Accepted answer
  1. ShaktiSingh-MSFT 13,826 Reputation points Microsoft Employee

    Hi @subhash-DBA ,

    We are sorry about the inconvenience.

    As suggested by Nacho Alonso Portillo •, product PM:

    For now, we cannot offer you an alternative since pg_stat_file requires superuser privileges to be executed.

    We will consider providing an alternative function to allow you to get that information.

    However, this won't be available before six months from now, at least.


2 additional answers

Sort by: Most helpful
  1. Nacho Alonso Portillo 5 Reputation points Microsoft Employee

    @subhash-DBA In on-prem systems and also in Azure Database for PostgreSQL Flexible Server, you can use the set of Database Object Size Functions which provide you the information you need, and are not limited to superusers.


    1 person found this answer helpful.

  2. Vahid Ghafarpour 18,450 Reputation points

    Thanks for posting your question in the Microsoft Q&A forum.

    Unfortunately, there isn’t a direct equivalent to the pg_stat_file method you mentioned.

    In addition looking at the table files won't necessarily give you the right information - there are table operations that will create a new file for you, in which case the date would reset.

    PS. Did you check extensions? maybe you can find good alternative for your requirement.

    You can find and install extensions as described in this article:

    ** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful **

    0 comments No comments