diff --git a/v2.0/helpers/datasets/datasetqueryfaster.sql b/v2.0/helpers/datasets/datasetqueryfaster.sql index 92ffc48d..97c3fc44 100644 --- a/v2.0/helpers/datasets/datasetqueryfaster.sql +++ b/v2.0/helpers/datasets/datasetqueryfaster.sql @@ -25,8 +25,8 @@ WITH filtered_datasets AS ( ORDER BY bigq.siteid, bigq.datasetid -- This is cheating a bit. We're querying a smaller chunk here and hoping that taking 3 times the datasets is enough -- to get us the actual limit. - LIMIT COALESCE(${limit}, 25) * 3 - OFFSET COALESCE(${offset}, 0) + -- LIMIT COALESCE(${limit}, 25) * 3 + -- OFFSET COALESCE(${offset}, 0) ), -- Now these CTEs work on a much smaller dataset dataset_dois AS ( diff --git a/v2.0/helpers/publications/pubdsidquery.sql b/v2.0/helpers/publications/pubdsidquery.sql index 4d42870a..f7bd77ba 100755 --- a/v2.0/helpers/publications/pubdsidquery.sql +++ b/v2.0/helpers/publications/pubdsidquery.sql @@ -1,7 +1,3 @@ -WITH dpub AS - (SELECT * FROM - ndb.datasetpublications as dp - WHERE ($1 IS NULL OR dp.datasetid IN ($1:csv))) SELECT json_build_object( 'datasets', json_agg(DISTINCT jsonb_build_object('siteid', dsl.siteid, 'datasetid', dpub.datasetid, @@ -35,9 +31,10 @@ SELECT json_build_object( 'givennames', ca.givennames, 'order', pa.authororder))) AS publication FROM ndb.publications AS pub - INNER JOIN ndb.publicationauthors AS pa ON pub.publicationid = pa.publicationid - INNER JOIN ndb.contacts as ca ON ca.contactid = pa.contactid - INNER JOIN ndb.publicationtypes AS pt ON pub.pubtypeid = pt.pubtypeid - INNER JOIN (SELECT * FROM dpub) AS dpub ON dpub.publicationid = pub.publicationid + LEFT JOIN ndb.publicationauthors AS pa ON pub.publicationid = pa.publicationid + LEFT JOIN ndb.contacts as ca ON ca.contactid = pa.contactid + LEFT JOIN ndb.publicationtypes AS pt ON pub.pubtypeid = pt.pubtypeid + LEFT JOIN ndb.datasetpublications as dpub ON dpub.publicationid = pub.publicationid LEFT JOIN ndb.dslinks AS dsl ON dsl.datasetid = dpub.datasetid -GROUP BY pub.publicationid, pt.pubtype + WHERE ($1 IS NULL OR dpub.datasetid IN ($1:csv)) +GROUP BY pub.publicationid, pt.pubtype \ No newline at end of file