Query editor
with max_epoch_cte as (select max(epoch) as max_epochfrom staking_solana.validator_stake_account_epochs)selects.voter as validator,sum(case when s.deactivation_epoch = -1 then 1 else 0 end) as active_stake_accounts,sum(case when s.deactivation_epoch != -1 then 1 else 0 end) as inactive_stake_accounts,count(distinct s.pubkey) as total_stake_accounts,sum(case when s.deactivation_epoch = -1 then 1 else 0 end) * 100.0 * 0.01 /count(distinct s.pubkey) as delegation_utilization_percent,sum(casewhen s.deactivation_epoch != -1 then s.deactivation_epochelse (select max_epoch from max_epoch_cte)end) - sum(s.activation_epoch) as total_stake_durationfrom dune.george_vsv.dataset_solana_address_staking_accs_info sgroup by 1order by total_stake_duration desc;