Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add requestkey indexes on events and transactions #98

Merged
merged 1 commit into from
Nov 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions exec/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ main = do
addEventsHeightNameParamsIndex logg conn
addFromAccountsIndex logg conn
addToAccountsIndex logg conn
addTransactionsRequestKeyIndex logg conn
addEventsRequestKeyIndex logg conn
logg Info "DB Tables Initialized"
let mgrSettings = mkManagerSettings (TLSSettingsSimple True False False) Nothing
m <- newManager mgrSettings
Expand Down Expand Up @@ -170,6 +172,24 @@ addToAccountsIndex =
, statement = "CREATE INDEX IF NOT EXISTS transfers_to_acct_height_idx_idx ON transfers (to_acct, height desc, idx);"
}

addTransactionsRequestKeyIndex :: LogFunctionIO Text -> Connection -> IO ()
addTransactionsRequestKeyIndex =
addIndex
IndexCreationInfo
{
message = "Adding \"(requestkey)\" index on transactions table"
, statement = "CREATE INDEX IF NOT EXISTS transactions_requestkey_idx ON transactions (requestkey);"
}

addEventsRequestKeyIndex :: LogFunctionIO Text -> Connection -> IO ()
addEventsRequestKeyIndex =
addIndex
IndexCreationInfo
{
message = "Adding \"(requestkey)\" index on events table"
, statement = "CREATE INDEX IF NOT EXISTS events_requestkey_idx ON events (requestkey);"
}

{-
λ> :main single --chain 2 --height 1487570 --service-host api.chainweb.com --p2p-host us-e3.chainweb.com --dbname chainweb-data --service-port 443 --service-https
λ> :main single --chain 0 --height 1494311 --service-host api.chainweb.com --p2p-host us-e3.chainweb.com --dbname chainweb-data --service-port 443 --service-https
Expand Down