So what can you do?
It turns out that in some databases like PostgreSQL, there is an easy solution for that:
create index concurrently index_name on table(column);
Yes, that’s it. This will switch the default behavior of the locking table and will create the index in parallel to standard operations that your app is doing on the DB.
This is dangerous advice. Before blindly following do read the documentation and understand the trade offs. It’s not the default behavior for a reason:
There are several caveats to be aware of when using this option — see Building Indexes Concurrently.
Good point, it made sense in our project, but as with everything there are drawbacks, and it is a bad idea to copy-paste from blog to project without researching on your own.
Along the lines of the malformed class name error, is a similar restriction around resource names. I found out the hard way recently that findResource won’t find resources named, say, bundle.js.map. This is because bundle.js.map does not follow the format of name.extension that is expected. The crazy bit is that you can still get at those resource files (they do end up in the JAR), just not with the conventional methods.
This is dangerous advice. Before blindly following do read the documentation and understand the trade offs. It’s not the default behavior for a reason:
source: https://www.postgresql.org/docs/11/sql-createindex.html
source: https://www.postgresql.org/docs/11/sql-createindex.html#SQL-CREATEINDEX-CONCURRENTLY
Good point, it made sense in our project, but as with everything there are drawbacks, and it is a bad idea to copy-paste from blog to project without researching on your own.
Along the lines of the malformed class name error, is a similar restriction around resource names. I found out the hard way recently that
findResource
won’t find resources named, say,bundle.js.map
. This is becausebundle.js.map
does not follow the format ofname.extension
that is expected. The crazy bit is that you can still get at those resource files (they do end up in the JAR), just not with the conventional methods.Have you checked how it behaves on newer JVMs?