Relative Content

Tag Archive for javascripthtmlsqljsonpostgresql

Format the JSON output of Postgres query in table format with dynamic rows

This is the JSON format of Postgres query and i want to show this output in table format with dynamic rows. Also I want to show the query column in dialog box by clicking on hyperlink of every row. We have to generate a hyperlink for every row which will direct to a dialog box containing full query of a particular row. Below is the JSON format. Also can we do this using only HTML, CSS and JS?
[{“queryid” : 857952013, “calls” : 291, “total_time” : 3073.728526, “mean_time” : 10.5626409828179, “min_time” : 0.474662, “max_time” : 13.095059, “query” : “SELECT relname AS table_name, seq_scan AS sequential_scans, seq_tup_read AS sequential_rows_read, idx_scan AS index_scans, idx_tup_fetch AS index_rows_fetched, n_tup_ins AS rows_inserted, n_tup_upd AS rows_updated, n_tup_del AS rows_deleted, pg_size_pretty(pg_total_relation_size(relid)) AS table_size, CASE WHEN seq_scan = $1 THEN $2 ELSE seq_tup_read / seq_scan END AS avg_seq_scan_latency, CASE WHEN idx_scan = $3 THEN $4 ELSE idx_tup_fetch / idx_scan END AS avg_idx_scan_latency FROM pg_stat_user_tables ORDER BY avg_seq_scan_latency DESC, avg_idx_scan_latency DESC LIMIT $5”},{……} ]

Format the JSON output of Postgres query in table format with dynamic rows

This is the JSON format of Postgres query and i want to show this output in table format with dynamic rows. Also I want to show the query column in dialog box by clicking on hyperlink of every row. We have to generate a hyperlink for every row which will direct to a dialog box containing full query of a particular row. Below is the JSON format. Also can we do this using only HTML, CSS and JS?
[{“queryid” : 857952013, “calls” : 291, “total_time” : 3073.728526, “mean_time” : 10.5626409828179, “min_time” : 0.474662, “max_time” : 13.095059, “query” : “SELECT relname AS table_name, seq_scan AS sequential_scans, seq_tup_read AS sequential_rows_read, idx_scan AS index_scans, idx_tup_fetch AS index_rows_fetched, n_tup_ins AS rows_inserted, n_tup_upd AS rows_updated, n_tup_del AS rows_deleted, pg_size_pretty(pg_total_relation_size(relid)) AS table_size, CASE WHEN seq_scan = $1 THEN $2 ELSE seq_tup_read / seq_scan END AS avg_seq_scan_latency, CASE WHEN idx_scan = $3 THEN $4 ELSE idx_tup_fetch / idx_scan END AS avg_idx_scan_latency FROM pg_stat_user_tables ORDER BY avg_seq_scan_latency DESC, avg_idx_scan_latency DESC LIMIT $5”},{……} ]