Skip to content

Commit

Permalink
add index for performance (#64)
Browse files Browse the repository at this point in the history
* add index for performance

* change index creation to yaml format
  • Loading branch information
kkehl-usgs committed Jul 28, 2020
1 parent b5b6ecd commit fa2952d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions liquibase/changeLogs/nldi/nldi_data/changeLog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</preConditions>

<include file="tables.sql" relativeToChangelogFile="true"/>
<include file="indexes/changeLog.yml" relativeToChangelogFile="true"/>
<include file="functions/changeLog.xml" relativeToChangelogFile="true"/>
<include file="grants.sql" relativeToChangelogFile="true"/>
<include file="update_crawler_source/changeLog.yml" relativeToChangelogFile="true"/>
Expand Down
10 changes: 10 additions & 0 deletions liquibase/changeLogs/nldi/nldi_data/indexes/changeLog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
databaseChangeLog:
- preConditions:
- dbms:
type: postgresql
-runningAs:
username: ${NLDI_SCHEMA_OWNER_USERNAME}

- include:
- file: webServiceLogId.yml
- relativeToChangelogFile: true
14 changes: 14 additions & 0 deletions liquibase/changeLogs/nldi/nldi_data/indexes/webServiceLogId.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
databaseChangeLog:
- changeSet:
author: kkehl
id: "create.index.nldi_data.web_service_log_id_identifier"
preConditions:
- onFail: MARK_RAN
- onError: HALT
- not:
- indexExists:
NLDI_SCHEMA_NAME: nldi_data
indexName: web_service_log_id_identifier
changes:
- sql: create index web_service_log_id_identifier on nldi_data.web_service_log(web_service_log_id);
- rollback: drop index if exists nldi_data.web_service_log_id_identifier;

0 comments on commit fa2952d

Please sign in to comment.