This repository has been archived by the owner on Feb 24, 2025. It is now read-only.
forked from blockscout/blockscout
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request blockscout#6511 from blockscout/np-fix-api-2-txs-1
Split ordering cases for txs
- Loading branch information
Showing
3 changed files
with
91 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
apps/explorer/priv/repo/migrations/20221126103223_add_txs_indexes.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
defmodule Explorer.Repo.Migrations.AddTxsIndexes do | ||
use Ecto.Migration | ||
@disable_ddl_transaction true | ||
@disable_migration_lock true | ||
|
||
def change do | ||
drop_if_exists( | ||
index( | ||
:transactions, | ||
[:from_address_hash, "block_number DESC NULLS FIRST", "index DESC NULLS FIRST", :hash], | ||
name: "transactions_from_address_hash_recent_collated_index", | ||
concurrently: true | ||
) | ||
) | ||
|
||
drop_if_exists( | ||
index( | ||
:transactions, | ||
[:to_address_hash, "block_number DESC NULLS FIRST", "index DESC NULLS FIRST", :hash], | ||
name: "transactions_to_address_hash_recent_collated_index", | ||
concurrently: true | ||
) | ||
) | ||
|
||
drop_if_exists( | ||
index( | ||
:transactions, | ||
[:created_contract_address_hash, "block_number DESC NULLS FIRST", "index DESC NULLS FIRST", :hash], | ||
name: "transactions_created_contract_address_hash_recent_collated_index", | ||
concurrently: true | ||
) | ||
) | ||
|
||
create_if_not_exists( | ||
index( | ||
:transactions, | ||
[ | ||
:from_address_hash, | ||
"block_number DESC NULLS FIRST", | ||
"index DESC NULLS FIRST", | ||
"inserted_at DESC", | ||
"hash ASC" | ||
], | ||
name: "transactions_from_address_hash_with_pending_index", | ||
concurrently: true | ||
) | ||
) | ||
|
||
create_if_not_exists( | ||
index( | ||
:transactions, | ||
[:to_address_hash, "block_number DESC NULLS FIRST", "index DESC NULLS FIRST", "inserted_at DESC", "hash ASC"], | ||
name: "transactions_to_address_hash_with_pending_index", | ||
concurrently: true | ||
) | ||
) | ||
|
||
create_if_not_exists( | ||
index( | ||
:transactions, | ||
[ | ||
:created_contract_address_hash, | ||
"block_number DESC NULLS FIRST", | ||
"index DESC NULLS FIRST", | ||
"inserted_at DESC", | ||
"hash ASC" | ||
], | ||
name: "transactions_created_contract_address_hash_with_pending_index", | ||
concurrently: true | ||
) | ||
) | ||
end | ||
end |