Code Monkey home page Code Monkey logo

Comments (7)

sdepold avatar sdepold commented on August 25, 2024

That is because of https://github.com/sequelize/umzug/blob/master/lib/storages/sequelize.js#L84 Why would you consider that a bottleneck?

from cli.

sdepold avatar sdepold commented on August 25, 2024

I can see that this is far from ideal. But tbh it has for me ultra high priority.

from cli.

cusspvz avatar cusspvz commented on August 25, 2024

Why would you consider that a bottleneck?

Because you don't need to initialize it and check on each migration run, but i think you already know that. :)

By the way, thanks for changing the table schema, it solved some problems we were getting when merging PRs with different timings. 👍

from cli.

rsshilli avatar rsshilli commented on August 25, 2024

That is because of https://github.com/sequelize/umzug/blob/master/lib/storages/sequelize.js#L84

Unfortunately this link is dead :-(

Why would you consider that a bottleneck?

This seems terribly inefficient. For each migration file (which we have over a hundred), the following 5 extra SQL statements are made (that I believe are unnecessary):

  • 2x CREATE TABLE IF NOT EXISTS
  • 2x SHOW INDEX FROM `SequelizeMeta`
  • 1x SELECT `name` FROM `SequelizeMeta`

Surely nobody is running two migrators against the same DB at the same time. And if they are, I don't see how this would help.

from cli.

cusspvz avatar cusspvz commented on August 25, 2024

Updated link:
https://github.com/sequelize/umzug/blob/67f99bcbee71da0f4a99d56edadc8b59e68bc6fe/src/storages/SequelizeStorage.js#L74-L93

Seems that now it is defined and re-used.
@rsshilli does it still happens?

from cli.

rsshilli avatar rsshilli commented on August 25, 2024

I'm on Umzug 1.11.0 (is that the latest?). I still see all of the SQL I mentioned above.

I worked around this mayhem by creating a mysql dump that I use to initialize new user's DBs. When a new user signs up, I'm reading in the MySQL dump and executing the queries one by one rather than executing the umzug migrations.

A few comparisons:

  • 156 migration files runs in ~10.7 seconds on an AWS t2.small RDS MySQL DB.
  • My mysql dump file runs in ~3.1 seconds (same SQL but without the extra needless create table, etc above)

I should also note that I (have to) turn off foreign key checks in the mysql dump (although there's no data there). But I suspect that makes the table creation a little faster. I'd be surprised if that made it twice as fast though.

from cli.

stale avatar stale commented on August 25, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.