Skip to content

Commit

Permalink
fix: too many indexes and missing indexes (#621)
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag authored Dec 19, 2024
1 parent faf326e commit ea3c6b9
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 57 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
- "16686:16686/tcp"

ledger:
image: golang:1.22-alpine
image: golang:1.23-alpine
entrypoint: go run main.go serve
volumes:
- .:/src
Expand Down
56 changes: 0 additions & 56 deletions internal/storage/bucket/default_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,6 @@ var ledgerSetups = []ledgerSetup{
), 1)::bigint, false);
`,
},
{
requireFeatures: features.FeatureSet{
features.FeatureMovesHistoryPostCommitEffectiveVolumes: "SYNC",
},
script: `create index "pcev_{{.ID}}" on "{{.Bucket}}".moves (accounts_address, asset, effective_date desc) where ledger = '{{.Name}}';`,
},
{
requireFeatures: features.FeatureSet{
features.FeatureMovesHistoryPostCommitEffectiveVolumes: "SYNC",
Expand Down Expand Up @@ -228,22 +222,6 @@ var ledgerSetups = []ledgerSetup{
execute procedure "{{.Bucket}}".insert_transaction_metadata_history();
`,
},
{
requireFeatures: features.FeatureSet{
features.FeatureIndexTransactionAccounts: "SYNC",
},
script: `
create index "transactions_sources_{{.ID}}" on "{{.Bucket}}".transactions using gin (sources jsonb_path_ops) where ledger = '{{.Name}}';
`,
},
{
requireFeatures: features.FeatureSet{
features.FeatureIndexTransactionAccounts: "ON",
},
script: `
create index "transactions_destinations_{{.ID}}" on "{{.Bucket}}".transactions using gin (destinations jsonb_path_ops) where ledger = '{{.Name}}';
`,
},
{
requireFeatures: features.FeatureSet{
features.FeatureIndexTransactionAccounts: "ON",
Expand All @@ -259,22 +237,6 @@ var ledgerSetups = []ledgerSetup{
execute procedure "{{.Bucket}}".set_transaction_addresses();
`,
},
{
requireFeatures: features.FeatureSet{
features.FeatureIndexAddressSegments: "ON",
},
script: `
create index "accounts_address_array_{{.ID}}" on "{{.Bucket}}".accounts using gin (address_array jsonb_ops) where ledger = '{{.Name}}';
`,
},
{
requireFeatures: features.FeatureSet{
features.FeatureIndexAddressSegments: "ON",
},
script: `
create index "accounts_address_array_length_{{.ID}}" on "{{.Bucket}}".accounts (jsonb_array_length(address_array)) where ledger = '{{.Name}}';
`,
},
{
requireFeatures: features.FeatureSet{
features.FeatureIndexAddressSegments: "ON",
Expand All @@ -290,24 +252,6 @@ var ledgerSetups = []ledgerSetup{
execute procedure "{{.Bucket}}".set_address_array_for_account();
`,
},
{
requireFeatures: features.FeatureSet{
features.FeatureIndexAddressSegments: "ON",
features.FeatureIndexTransactionAccounts: "ON",
},
script: `
create index "transactions_sources_arrays_{{.ID}}" on "{{.Bucket}}".transactions using gin (sources_arrays jsonb_path_ops) where ledger = '{{.Name}}';
`,
},
{
requireFeatures: features.FeatureSet{
features.FeatureIndexAddressSegments: "ON",
features.FeatureIndexTransactionAccounts: "ON",
},
script: `
create index "transactions_destinations_arrays_{{.ID}}" on "{{.Bucket}}".transactions using gin (destinations_arrays jsonb_path_ops) where ledger = '{{.Name}}';
`,
},
{
requireFeatures: features.FeatureSet{
features.FeatureIndexAddressSegments: "ON",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name: Create accounts metadata index concurrently
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
create index concurrently accounts_metadata_idx on "{{.Schema}}".accounts using gin(metadata JSONB_PATH_OPS);

0 comments on commit ea3c6b9

Please sign in to comment.