Skip to content
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

Table.exists() very slow in Postgres Environments with a lot of objects #1701

Closed
RobertRad opened this issue Jul 10, 2017 · 2 comments
Closed

Table.exists() very slow in Postgres Environments with a lot of objects #1701

RobertRad opened this issue Jul 10, 2017 · 2 comments

Comments

@RobertRad
Copy link
Contributor

@RobertRad RobertRad commented Jul 10, 2017

What version of Flyway are you using?

4.2.0

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin, SBT plugin, ANT tasks)

Java API

What database are you using (type & version)?

Postgres 9.5

What did you do?

Run migrations on a database with many objects.
Objects are all tables/indexes/sequences in all schemas.

What did you expect to see?

I expected a negligible overhead for the calls to Table.exists()

What did you see instead?

A single call to Table.exists() - or more precisely PostgreSQLTable.doExists() - has a significant overhead.

On a database with over 500.000 Objects a single call can take more than 250ms.

When calling Flyway.migrate() the method is called about 8 times and then 3 times per Script.
This might sum up to a huge overhead. Especially with a lot of schemas (which lead to the many objects).

Of course this is a problem with Postgres in the first place, but unfortunately leads to difficulties when doing migrations with Flyway .

@RobertRad
Copy link
Contributor Author

@RobertRad RobertRad commented Jul 10, 2017

@axelfontaine axelfontaine added this to the Flyway 5.0.0 milestone Jul 10, 2017
axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Sep 5, 2017
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Sep 5, 2017

Fixed by #1702

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.