Postgresql fastest way of getting the set of unique values in one column or a large table
问题 I have a constantly growing, potentially very large table in a Postgresql database that contains "data" from different "channels" for different "devices" eg.: Table data: id (PK) device_id (FK -> device) channel_id (FK -> channel) timestamp (TIMESTAMP) value (Float) I am using partitioning to separate the table into multiple subtables, one for each device, since I never need data for different devices in the same query. Since not all devices supply all channels, I would like to get a list of