Skip to content

Commit

Permalink
add index to event.emitter_addr
Browse files Browse the repository at this point in the history
  • Loading branch information
i-norden committed Dec 11, 2023
1 parent 36298e5 commit b3b1695
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion chain/events/filter/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ var ddls = []string{
)`,

`CREATE INDEX IF NOT EXISTS height_tipset_key ON event (height,tipset_key)`,
`CREATE INDEX IF NOT EXISTS event_emitter_addr ON event (emitter_addr)`,

`CREATE TABLE IF NOT EXISTS event_entry (
event_id INTEGER,
Expand Down Expand Up @@ -327,7 +328,8 @@ func NewEventIndex(ctx context.Context, path string, chainStore *store.ChainStor
if version == 2 {
log.Infof("upgrading event index from version 1 to version 2")

// to upgrade to version 3 we only need to create an index on the event entries table (key) column
// to upgrade to version 3 we only need to create an index on the event_entry.key column
// and on the event.emitter_addr column
// which means we can just reapply the schema (it will not have any effect on existing data)
for _, ddl := range ddls {
if _, err := db.Exec(ddl); err != nil {
Expand Down

0 comments on commit b3b1695

Please sign in to comment.