diff --git a/.run/Run testnet.run.xml b/.run/Run testnet.run.xml
index 93e31fe..40a9309 100644
--- a/.run/Run testnet.run.xml
+++ b/.run/Run testnet.run.xml
@@ -25,6 +25,7 @@
+
\ No newline at end of file
diff --git a/cmd/mempool/views/dipdup_head_status.sql b/cmd/mempool/views/dipdup_head_status.sql
index 1a026a0..15dfce0 100644
--- a/cmd/mempool/views/dipdup_head_status.sql
+++ b/cmd/mempool/views/dipdup_head_status.sql
@@ -7,5 +7,9 @@ SELECT
END AS status,
created_at,
updated_at
-FROM
- dipdup_state;
+FROM dipdup_state;
+
+comment on column dipdup_head_status.index_name is 'Name of the index.';
+comment on column dipdup_head_status.status is 'Status of head ("OK" or "OUTDATED" if relevance of head is more than three minutes behind)';
+comment on column dipdup_head_status.created_at is 'Date of creation in seconds since UNIX epoch.';
+comment on column dipdup_head_status.updated_at is 'Date of last update in seconds since UNIX epoch.';
diff --git a/cmd/mempool/views/mutez_per_gas_unit.sql b/cmd/mempool/views/mutez_per_gas_unit.sql
index 3490bb9..23023ed 100644
--- a/cmd/mempool/views/mutez_per_gas_unit.sql
+++ b/cmd/mempool/views/mutez_per_gas_unit.sql
@@ -1,8 +1,25 @@
create or replace view mutez_per_gas_unit as
- select gas.waiting_levels , max(mutez_per_gas_unit), min(mutez_per_gas_unit), avg(mutez_per_gas_unit) as avg, count(mutez_per_gas_unit), percentile_disc(0.5) within group (order by gas.mutez_per_gas_unit) as median from (
- select
- (level_in_chain - level_in_mempool) as waiting_levels,
- ((total_fee - 100 - 150 * 1)::float / total_gas_used) as mutez_per_gas_unit
- from gas_stats gs where level_in_chain > 0 and level_in_mempool > 0 and total_gas_used > 0
- ) as gas
- group by gas.waiting_levels;
\ No newline at end of file
+ select gas.waiting_levels,
+ max(mutez_per_gas_unit),
+ min(mutez_per_gas_unit),
+ avg(mutez_per_gas_unit) as avg,
+ count(mutez_per_gas_unit),
+ percentile_disc(0.5) within group (order by gas.mutez_per_gas_unit) as median
+ from (
+ select
+ (level_in_chain - level_in_mempool) as waiting_levels,
+ ((total_fee - 100 - 150 * 1)::float / total_gas_used) as mutez_per_gas_unit
+ from gas_stats gs
+ where level_in_chain > 0
+ and level_in_mempool > 0
+ and total_gas_used > 0
+ ) as gas
+ group by gas.waiting_levels;
+
+comment on view mutez_per_gas_unit is 'Statistics for micro tez per gas unit.';
+comment on column mutez_per_gas_unit.waiting_levels is 'Difference between level in chain and level in mempool.';
+comment on column mutez_per_gas_unit.max is 'Maximum price for gas unit.';
+comment on column mutez_per_gas_unit.min is 'Minimum price for gas unit.';
+comment on column mutez_per_gas_unit.avg is 'Average price for gas unit.';
+comment on column mutez_per_gas_unit.count is 'Count of prices for gas unit.';
+comment on column mutez_per_gas_unit.median is 'Percentile (50%) of price for gas unit.';
diff --git a/cmd/mempool/views/operation_groups.sql b/cmd/mempool/views/operation_groups.sql
index 840bd1b..c1cef12 100644
--- a/cmd/mempool/views/operation_groups.sql
+++ b/cmd/mempool/views/operation_groups.sql
@@ -1,12 +1,40 @@
create or replace view operation_groups as
- select network, hash, max(status) as status, max(source) as source, max(expiration_level) as expiration_level, max(level) as level, max(branch) as branch, sum(fee) as fee, max(counter) as max_counter, sum(storage_limit) as storage_limit, sum(gas_limit) as gas_limit, count(*) as num_contents, min(created_at) as created_at from
- (
- select network, status, source, expiration_level, level, branch, hash, fee, counter, storage_limit, gas_limit, created_at from "transactions"
- union all
- select network, status, source, expiration_level, level, branch, hash, fee, counter, storage_limit, gas_limit, created_at from delegations
- union all
- select network, status, source, expiration_level, level, branch, hash, fee, counter, storage_limit, gas_limit, created_at from originations
- union all
- select network, status, source, expiration_level, level, branch, hash, fee, counter, storage_limit, gas_limit, created_at from reveals
- ) as foo
- group by network, hash;
\ No newline at end of file
+ select network,
+ hash,
+ max(status) as status,
+ max(source) as source,
+ max(expiration_level) as expiration_level,
+ max(level) as level,
+ max(branch) as branch,
+ sum(fee) as fee,
+ max(counter) as max_counter,
+ sum(storage_limit) as storage_limit,
+ sum(gas_limit) as gas_limit,
+ count(*) as num_contents,
+ min(created_at) as created_at
+ from
+ (
+ select network, status, source, expiration_level, level, branch, hash, fee, counter, storage_limit, gas_limit, created_at from "transactions"
+ union all
+ select network, status, source, expiration_level, level, branch, hash, fee, counter, storage_limit, gas_limit, created_at from delegations
+ union all
+ select network, status, source, expiration_level, level, branch, hash, fee, counter, storage_limit, gas_limit, created_at from originations
+ union all
+ select network, status, source, expiration_level, level, branch, hash, fee, counter, storage_limit, gas_limit, created_at from reveals
+ ) as foo
+ group by network, hash;
+
+comment on view operation_groups is 'Statistics per operations (transactions, delegations, originations, reveals) grouped by network and hash.';
+comment on column operation_groups.network is 'Network of the group.';
+comment on column operation_groups.hash is 'Hash of the operation group.';
+comment on column operation_groups.status is 'Status (max) of the operation group.';
+comment on column operation_groups.source is 'Source (max) of the operation group.';
+comment on column operation_groups.expiration_level is 'Expiration (max) level of the operation group.';
+comment on column operation_groups.level is 'Level (max) of the operation group.';
+comment on column operation_groups.branch is 'Branch (max) of the operation group.';
+comment on column operation_groups.fee is 'Sum of the fee of the operation group.';
+comment on column operation_groups.max_counter is 'Maximum counter of the operation group.';
+comment on column operation_groups.storage_limit is 'Sum of the storage limit of the operation group.';
+comment on column operation_groups.gas_limit is 'Sum of the gas limit of the operation group.';
+comment on column operation_groups.num_contents is 'Number of operations in group.';
+comment on column operation_groups.created_at is 'Date of fist operation creation in seconds since UNIX epoch.'