7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/ruby_pg_extras/table_info.rb', line 7
def call(table_name)
tables_data.select do |table_data|
if table_name == nil
true
else
table_data.fetch("tablename") == table_name
end
end.sort_by do |table_data|
table_data.fetch("tablename")
end.map do |table_data|
table_name = table_data.fetch("tablename")
{
table_name: table_name,
table_size: table_size_data.find do |el|
el.fetch("name") == table_name
end.fetch("size", "N/A"),
table_cache_hit: table_cache_hit_data.find do |el|
el.fetch("name") == table_name
end.fetch("ratio", "N/A"),
indexes_cache_hit: index_cache_hit_data.find do |el|
el.fetch("name") == table_name
end.fetch("ratio", "N/A"),
estimated_rows: records_rank_data.find do |el|
el.fetch("name") == table_name
end.fetch("estimated_count", "N/A"),
sequential_scans: seq_scans_data.find do |el|
el.fetch("name") == table_name
end.fetch("count", "N/A"),
indexes_scans: table_index_scans_data.find do |el|
el.fetch("name") == table_name
end.fetch("count", "N/A")
}
end
end
|