diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-08-19 18:42:21 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-08-19 18:42:21 -0700 |
commit | 657c1e7d4d6f07762bc1f6a7b24e9512e0089987 (patch) | |
tree | 88792a804223e7494c840a3f436b59702dec62cd /rust | |
parent | 582d2397004b8a55847a3fe933cc29e8b99ab8f6 (diff) | |
download | fatcat-657c1e7d4d6f07762bc1f6a7b24e9512e0089987.tar.gz fatcat-657c1e7d4d6f07762bc1f6a7b24e9512e0089987.zip |
add NOT NULL to other lookups
Diffstat (limited to 'rust')
-rw-r--r-- | rust/src/api_server.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs index 9239d63b..66e6359a 100644 --- a/rust/src/api_server.rs +++ b/rust/src/api_server.rs @@ -396,6 +396,9 @@ impl Server { let (ident, rev): (FileIdentRow, FileRevRow) = file_ident::table .inner_join(file_rev::table) .filter(file_rev::sha1.eq(sha1)) + // This NOT NULL is here to ensure the postgresql query planner that it can use an + // index + .filter(file_rev::sha1.is_not_null()) .filter(file_ident::is_live.eq(true)) .filter(file_ident::redirect_id.is_null()) .first(conn)?; @@ -434,6 +437,9 @@ impl Server { let (ident, rev): (ReleaseIdentRow, ReleaseRevRow) = release_ident::table .inner_join(release_rev::table) .filter(release_rev::doi.eq(doi)) + // This NOT NULL is here to ensure the postgresql query planner that it can use an + // index + .filter(release_rev::doi.is_not_null()) .filter(release_ident::is_live.eq(true)) .filter(release_ident::redirect_id.is_null()) .first(conn)?; |