Merge pull request #9323 from blockscout/vb-set-concurrent-index-creation

Change index creation to concurrent
pull/9330/head
Victor Baranov 10 months ago committed by GitHub
commit 108b9e8612
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 4
      apps/explorer/priv/repo/migrations/20240114181404_enhanced_unfetched_token_balances_index.exs
  3. 5
      apps/explorer/priv/repo/migrations/20240123102336_add_tokens_cataloged_index.exs

@ -55,6 +55,7 @@
### Chore ### Chore
- [#9323](https://github.com/blockscout/blockscout/pull/9323) - Change index creation to concurrent
- [#9322](https://github.com/blockscout/blockscout/pull/9322) - Create repo setup actions - [#9322](https://github.com/blockscout/blockscout/pull/9322) - Create repo setup actions
- [#9303](https://github.com/blockscout/blockscout/pull/9303) - Add workflow for Shibarium - [#9303](https://github.com/blockscout/blockscout/pull/9303) - Add workflow for Shibarium
- [#9233](https://github.com/blockscout/blockscout/pull/9233) - "cataloged" index on tokens table - [#9233](https://github.com/blockscout/blockscout/pull/9233) - "cataloged" index on tokens table

@ -1,9 +1,11 @@
defmodule Explorer.Repo.Migrations.EnhancedUnfetchedTokenBalancesIndex do defmodule Explorer.Repo.Migrations.EnhancedUnfetchedTokenBalancesIndex do
use Ecto.Migration use Ecto.Migration
@disable_ddl_transaction true
@disable_migration_lock true
def up do def up do
execute(""" execute("""
CREATE INDEX unfetched_address_token_balances_index on address_token_balances(id) CREATE INDEX CONCURRENTLY unfetched_address_token_balances_index on address_token_balances(id)
WHERE ( WHERE (
((address_hash != '\\x0000000000000000000000000000000000000000' AND token_type = 'ERC-721') OR token_type = 'ERC-20' OR token_type = 'ERC-1155') AND (value_fetched_at IS NULL OR value IS NULL) ((address_hash != '\\x0000000000000000000000000000000000000000' AND token_type = 'ERC-721') OR token_type = 'ERC-20' OR token_type = 'ERC-1155') AND (value_fetched_at IS NULL OR value IS NULL)
); );

@ -1,5 +1,7 @@
defmodule Explorer.Repo.Migrations.AddTokensCatalogedIndex do defmodule Explorer.Repo.Migrations.AddTokensCatalogedIndex do
use Ecto.Migration use Ecto.Migration
@disable_ddl_transaction true
@disable_migration_lock true
def change do def change do
create( create(
@ -7,7 +9,8 @@ defmodule Explorer.Repo.Migrations.AddTokensCatalogedIndex do
:tokens, :tokens,
~w(cataloged)a, ~w(cataloged)a,
name: :uncataloged_tokens, name: :uncataloged_tokens,
where: ~s|"cataloged" = false| where: ~s|"cataloged" = false|,
concurrently: true
) )
) )
end end

Loading…
Cancel
Save