Skip to content

Commit

Permalink
fix: too wide queries with withdrawals (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
vgorkavenko committed Apr 5, 2023
1 parent b7ae5fb commit d674e03
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/storage/clickhouse/clickhouse.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const avgValidatorBalanceDelta = (epoch: Epoch): string => `
FROM validators_summary
WHERE
val_nos_id IS NOT NULL AND
val_balance_withdrawn > 0 AND
epoch > (${epoch} - 6) AND epoch <= ${epoch}
LIMIT 1 BY epoch, val_id
)
Expand Down Expand Up @@ -75,6 +76,7 @@ export const validatorQuantile0001BalanceDeltasQuery = (epoch: Epoch): string =>
FROM validators_summary
WHERE
val_nos_id IS NOT NULL AND
val_balance_withdrawn > 0 AND
epoch > (${epoch} - 6) AND epoch <= ${epoch}
LIMIT 1 BY epoch, val_id
)
Expand Down Expand Up @@ -117,6 +119,7 @@ export const validatorsCountWithNegativeDeltaQuery = (epoch: Epoch): string => `
FROM validators_summary
WHERE
val_nos_id IS NOT NULL AND
val_balance_withdrawn > 0 AND
epoch > (${epoch} - 6) AND epoch <= ${epoch}
LIMIT 1 BY epoch, val_id
)
Expand Down Expand Up @@ -325,6 +328,7 @@ export const totalBalance24hDifferenceQuery = (epoch: Epoch): string => `
FROM validators_summary
WHERE
val_nos_id IS NOT NULL AND
val_balance_withdrawn > 0 AND
epoch > (${epoch} - 225) AND epoch <= ${epoch}
LIMIT 1 BY epoch, val_id
)
Expand Down Expand Up @@ -368,6 +372,7 @@ export const operatorBalance24hDifferenceQuery = (epoch: Epoch): string => `
FROM validators_summary
WHERE
val_nos_id IS NOT NULL AND
val_balance_withdrawn > 0 AND
epoch > (${epoch} - 225) AND epoch <= ${epoch}
LIMIT 1 BY epoch, val_id
)
Expand Down Expand Up @@ -611,6 +616,7 @@ export const userNodeOperatorsRewardsAndPenaltiesStats = (epoch: Epoch): string
FROM validators_summary
WHERE
val_nos_id IS NOT NULL AND
val_balance_withdrawn > 0 AND
epoch = ${epoch}
LIMIT 1 BY val_id
)
Expand Down Expand Up @@ -707,6 +713,7 @@ export const userNodeOperatorsWithdrawalsStats = (epoch: Epoch): string => `
FROM validators_summary
WHERE
val_nos_id IS NOT NULL AND
val_balance_withdrawn > 0 AND
epoch = ${epoch}
LIMIT 1 BY val_id
)
Expand Down Expand Up @@ -748,6 +755,7 @@ export const otherChainWithdrawalsStats = (epoch: Epoch): string => `
FROM validators_summary
WHERE
val_nos_id IS NULL AND
val_balance_withdrawn > 0 AND
epoch = ${epoch}
LIMIT 1 BY val_id
)
Expand Down

0 comments on commit d674e03

Please sign in to comment.