Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· openaiHugging Face Suzhen/CodeChat

command to find size of postgresql object by oid? and command to find oid of object like…

  1. User

    command to find size of postgresql object by oid? and command to find oid of object like database or table named Test

  2. Assistant

    To find the size of a PostgreSQL object by its oid, you can use the pg_size_pretty() function along with the pg_total_relation_size() function. Here's the command:

    SELECT pg_size_pretty(pg_total_relation_size('your_object_oid'));
    

    Replace 'your_object_oid' with the actual oid value of the object you want to check.

    To find the oid of an object like a database or a table named "Test", you can use the following commands:

    For a database:

    SELECT oid FROM pg_database WHERE datname = 'Test';
    

    For a table:

    SELECT oid FROM pg_class WHERE relname = 'Test';
    

    Replace 'Test' with the actual name of the object you want to find the oid for.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.