Find tables without primary keys (PKs) in Vertica database

Bart Gawrych - Dataedo Team Bart Gawrych 2019-10-31

Table of Contents:

    Query below lists tables in a database without primary keys.


    select tab.table_schema,
    from v_catalog.tables tab
    left join v_catalog.primary_keys pk
              on tab.table_schema = pk.table_schema
              and tab.table_name = pk.table_name
    where pk.constraint_id is null
    order by tab.table_schema,


    • table_schema - schema name
    • table_name - table name


    • One row represents one table in a database without primary key
    • Scope of rows: all tables without primary keys in a database
    • Ordered by schema, table name

    Sample results

    Below is a list of tables in Vertica database without primary keys. Is that a lot? Check out here.

    There are no comments. Click here to write the first comment.

    By continuing to use our website, you consent to the use of cookies in accordance with our Privacy Policy (updated 28-04-2020).