Netezza find distribution key of a table programatically
-
20-12-2019 - |
Question
Is it possible to programatically find what sort of distribution algorithm a Netezza table is using?
I can do it manually in Workbench by exporting table DDL but I would like to be able to do it programatically by running some sort of metadata SQL query.
I looked into most system tables but can't find this information anywhere.
Any ideas?
Solution
There might be a solution to this.
Running this query:
select * from _v_table_dist_map where database='database' and tablename='tablename';
If it returns no rows, it can be assumed a random distribution is being used (DISTRIBUTE ON RANDOM).
If it returns 1 or more rows, column based destribution is being used (DISTRIBUTE ON (col1, ..., coln)).
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow