Add indexes to event.emitter_addr
and event_entry.key
#4
@ -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 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 (
|
`CREATE TABLE IF NOT EXISTS event_entry (
|
||||||
event_id INTEGER,
|
event_id INTEGER,
|
||||||
@ -327,7 +328,8 @@ func NewEventIndex(ctx context.Context, path string, chainStore *store.ChainStor
|
|||||||
if version == 2 {
|
if version == 2 {
|
||||||
log.Infof("upgrading event index from version 1 to 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)
|
// which means we can just reapply the schema (it will not have any effect on existing data)
|
||||||
for _, ddl := range ddls {
|
for _, ddl := range ddls {
|
||||||
if _, err := db.Exec(ddl); err != nil {
|
if _, err := db.Exec(ddl); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user