Query editor
with parameters as (/** Number of equal-population quantile buckets over n_txs.** 100 gives percentile-level granularity.* Increase to 200 for finer granularity if the number of* account-level observations is sufficiently large.*/selectcast(100 as bigint) as n_quantile_bins),account_level as (selectaccount,cast(n_txs as bigint) as n_txs,cast(avg_number_of_lookup_tables as double) as avg_number_of_lookup_tablesfrom query_8134041wheren_txs > 0and avg_number_of_lookup_tables is not null),/** Rank accounts by their observed transaction frequency and divide* them into equal-population quantile buckets.** The account address is used as a deterministic tie-breaker when* multiple accounts have the same n_txs.*/account_quantile_buckets as (selectaccount_level.*,parameters.n_quantile_bins,ntile(parameters.n_quantile_bins) over (order byaccount_level.n_txs,account_level.account) as n_txs_quantile_bucketfrom account_levelcross join parameters),/** Calculate:** - the n_txs range represented by each quantile bucket;