summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-08-19 18:31:09 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-08-19 18:31:09 -0700
commit582d2397004b8a55847a3fe933cc29e8b99ab8f6 (patch)
treefb547cb29b74ceaae65bed8772f2d513d4978019
parent42fa2a4d01d31922de2a61881860840f2bfa80f5 (diff)
downloadfatcat-582d2397004b8a55847a3fe933cc29e8b99ab8f6.tar.gz
fatcat-582d2397004b8a55847a3fe933cc29e8b99ab8f6.zip
add hints for postgres query planner
-rw-r--r--rust/src/api_server.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs
index f7866b68..9239d63b 100644
--- a/rust/src/api_server.rs
+++ b/rust/src/api_server.rs
@@ -318,6 +318,9 @@ impl Server {
let (ident, rev): (ContainerIdentRow, ContainerRevRow) = container_ident::table
.inner_join(container_rev::table)
.filter(container_rev::issnl.eq(issnl))
+ // This NOT NULL is here to ensure the postgresql query planner that it can use an
+ // index
+ .filter(container_rev::issnl.is_not_null())
.filter(container_ident::is_live.eq(true))
.filter(container_ident::redirect_id.is_null())
.first(conn)?;
@@ -344,6 +347,9 @@ impl Server {
let (ident, rev): (CreatorIdentRow, CreatorRevRow) = creator_ident::table
.inner_join(creator_rev::table)
.filter(creator_rev::orcid.eq(orcid))
+ // This NOT NULL is here to ensure the postgresql query planner that it can use an
+ // index
+ .filter(creator_rev::orcid.is_not_null())
.filter(creator_ident::is_live.eq(true))
.filter(creator_ident::redirect_id.is_null())
.first(conn)?;