aggregate_stats

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// QueryEarliestConsensusBlockTime is the query to get the timestamp of the earliest
	// indexed consensus block.
	QueryEarliestConsensusBlockTime = `
		SELECT time
		FROM chain.blocks
		ORDER BY height
		LIMIT 1
	`

	// QueryEarliestRuntimeBlockTime is the query to get the timestamp of the earliest
	// indexed runtime block.
	QueryEarliestRuntimeBlockTime = `
		SELECT timestamp
		FROM chain.runtime_blocks
		WHERE (runtime = $1)
		ORDER BY round
		LIMIT 1
	`
	// QueryLatestConsensusBlockTime is the query to get the timestamp of the latest
	// indexed consensus block.
	QueryLatestConsensusBlockTime = `
		SELECT time
		FROM chain.blocks
		ORDER BY height DESC
		LIMIT 1
	`
	// QueryLatestRuntimeBlockTime is the query to get the timestamp of the latest
	// indexed runtime block.
	QueryLatestRuntimeBlockTime = `
		SELECT timestamp
		FROM chain.runtime_blocks
		WHERE (runtime = $1)
		ORDER BY round DESC
		LIMIT 1
	`

	// QueryConsensusTxVolume is the query to get the number the number of transactions
	// in the given window at the consensus layer.
	QueryConsensusTxVolume = `` /* 307-byte string literal not displayed */

	// QueryRuntimeTxVolume is the query to get the number of of transactions
	// in the runtime layer within the given time range.
	QueryRuntimeTxVolume = `` /* 153-byte string literal not displayed */

	// QueryLatestStatsComputation is the query to get the timestamp of the latest computed stat window.
	QueryLatestStatsComputation = `
		SELECT window_end
		FROM %s
		WHERE layer = $1
		ORDER BY window_end DESC
		LIMIT 1
	`

	// QueryInsertStatsComputation is the query to insert the stats computation.
	QueryInsertStatsComputation = `
		INSERT INTO %s (layer, window_end, %s)
		VALUES ($1, $2, $3)
	`

	// QueryConsensusActiveAccounts is the query to get the number of
	// active accounts in the consensus layer within the given time range.
	QueryConsensusActiveAccounts = `` /* 360-byte string literal not displayed */

	// QueryRuntimeActiveAccounts is the query to get the number of
	// active accounts in the runtime layer within the given time range.
	//
	// Note: We explicitly convert the timestamp range to a round range
	// to force postgres to use the corresponding index on the
	// chain.runtime_related_transactions table. Without this conversion,
	// postgres does not realize that the timestamps correspond to a sequential
	// set of rounds and does a full table scan.
	//
	// Note 2: The subselects push postgres to use the `timestamp` index
	// on `runtime_blocks`.
	QueryRuntimeActiveAccounts = `` /* 395-byte string literal not displayed */

	// QueryDailyTxVolume is the query to get the number of transactions within the given
	// time range, by using the already computed 5 minute windowed data.
	QueryDailyTxVolume = `` /* 168-byte string literal not displayed */

	// QueryLatestMin5TxVolume is the query to get the timestamp of the latest computed
	// 5 minute windowed data for the given layer.
	QueryLatestMin5TxVolume = `
		SELECT window_end
		FROM stats.min5_tx_volume as t
		WHERE t.layer = $1
		ORDER BY window_end DESC
		LIMIT 1
	`
)

Variables

This section is empty.

Functions

func NewAggregateStatsAnalyzer

func NewAggregateStatsAnalyzer(target storage.TargetStorage, logger *log.Logger) (analyzer.Analyzer, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL