columnExists precondition could be much faster (Oracle, mssql)
Description
Environment
Oracle 11g
SQL Server 2008
Activity
Show:
Nathan Voxland March 25, 2015 at 7:23 PM
Merged pull request

Piotr Findeisen March 11, 2015 at 1:20 PM
,
I've noticed the current implementation of columnExists
precondition fails (i.e. does not error) when the whole table does not exist. Based on this, I created a tuned version of this precondition that behaves the same, but does not even look into database metadata. It's a bit of a hack, but it works very well on what i test on – postgresql, sql server, oracle and h2.
Pull request: https://github.com/liquibase/liquibase/pull/375
<columnExists>
precondition (ColumnExistsPrecondition
) seems to read all tables and columns within schema.On my Oracle 11g and SQL Server 2008 databases this takes about 3s each time.
I believe a simple SQL lookup in system objects (as commonly done in changes/generators) would be possible in 0.1-0.2 s, yielding significant performance improvements when
<columnExists>
precondition is used repeatedly.