mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-27 03:07:14 +00:00
Update Postgresql example (#4642)
The query with pg_size_pretty returns the value as a string, that way you can’t have a nice chart or make value comparison. Inserted new query to return value as number.
This commit is contained in:
parent
ddf522bb7b
commit
88d890aa46
@ -90,6 +90,12 @@ SELECT * FROM states WHERE entity_id='binary_sensor.xyz789' GROUP BY state ORDER
|
|||||||
|
|
||||||
### {% linkable_title Database size in Postgres %}
|
### {% linkable_title Database size in Postgres %}
|
||||||
|
|
||||||
```sql
|
```yaml
|
||||||
SELECT pg_size_pretty(pg_database_size('Database Name'));
|
- platform: sql
|
||||||
|
db_url: postgresql://user:password@host/dbname
|
||||||
|
queries:
|
||||||
|
- name: db_size
|
||||||
|
query: "SELECT (pg_database_size('dsmrreader')/1024/1024) as db_size;"
|
||||||
|
column: "db_size"
|
||||||
|
unit_of_measurement: MB
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user