8000 index on sql database to allow hass to startup quickly with a large sql database by cmsimike · Pull Request #8255 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

index on sql data 8000 base to allow hass to startup quickly with a large sql database #8255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2017
Merged

index on sql database to allow hass to startup quickly with a large sql database #8255

merged 1 commit into from
Jul 1, 2017

Conversation

cmsimike
Copy link
Contributor

Description:

hass starts up very slow with a large SQL database. This adds an index to the states table to help (tremendously) with startup speed.

Related issue (if applicable): fixes #8176

Checklist:

If user exposed functionality or configuration variables are added/changed:

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • [na] Tests have been added to verify that the new code works.

@mention-bot
Copy link

@cmsimike, thanks for your PR! By analyzing the history of the files in this pull request, we identified @rhooper, @balloob and @m00dawg to be potential reviewers.

@cmsimike
Copy link
Contributor Author
cmsimike commented Jun 30, 2017

@pvizeli Hi - I believe I've seen you deal with the issue of a stuck cla-bot before? If not, do you know how I can go about getting the bot working again?

edit Looks like you tried - thanks! But it is still stuck :(

@@ -64,6 +64,7 @@ def _apply_update(engine, new_version):
# Create indexes for states
_create_index(engine, "states", "ix_states_last_updated")
_create_index(engine, "states", "ix_states_entity_id_created")
_create_index(engine, "states", "ix_states_created_domain")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work. You need to create a new migration version. Otherwise people that already had this migration (=everyone) will not get it applied.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@balloob thanks! Looking at it, is the correct way to acheive this:

  • Update models.py#SCHEMA_VERSION to 3
  • Change migration.py#_applyUpdates to include a new block
    elif new_version == 3: with my index migration

Anything else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@cmsimike
Copy link
Contributor Author
cmsimike commented Jul 1, 2017

@balloob @pvizeli I believe I have submitted the changes as requested, however Travis is failing for reasons unknown to me - tox passes in my dev env:
Results (303.52s):
2204 passed
50 skipped

Please advise?

@cmsimike
Copy link
Contributor Author
cmsimike commented Jul 1, 2017

Ah - looks like my email wasn't correctly set in the first round of commits. What would be the best way to deal with this? I presume this is why CLA-bot is stuck?

@pvizeli
Copy link
Member
pvizeli commented Jul 1, 2017

We can merge it, you need no change for cabot

@balloob
Copy link
Member
balloob commented Jul 1, 2017

Can you please squash all your commits and make sure they have the right email attached. Otherwise the CLA bot won't pass for the release either.

@cmsimike
Copy link
Contributor Author
cmsimike commented Jul 1, 2017

@balloob Done!

@balloob balloob merged commit 0bf5021 into home-assistant:dev Jul 1, 2017
@balloob
Copy link
Member
balloob commented Jul 1, 2017

Awesome! Cherry-picked for 0.48

@balloob balloob mentioned this pull request Jul 1, 2017
@balloob balloob mentioned this pull request Jul 13, 2017
dethpickle pushed a commit to dethpickle/home-assistant that referenced this pull request Aug 18, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Oct 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

15 minute restart time after 0.46 (yes 46)
6 participants
0