-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from dipdup-io/GO-75-add-comments-to-views
- Loading branch information
Showing
4 changed files
with
70 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
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.'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
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.' |