From eb125cd328a5291bf7d22db11eddfd351d498b8d Mon Sep 17 00:00:00 2001 From: hoffmanick <134728053+hoffmanick@users.noreply.github.com> Date: Wed, 20 May 2026 06:38:54 -0500 Subject: [PATCH 1/2] update for stable pagination --- v2.0/helpers/datasets/datasetqueryfaster.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 ( From 365bd7580963cbff893bc43b44059ed8fae6bb43 Mon Sep 17 00:00:00 2001 From: hoffmanick <134728053+hoffmanick@users.noreply.github.com> Date: Fri, 29 May 2026 11:47:43 -0500 Subject: [PATCH 2/2] Update pubsidquery to show all pubs --- v2.0/helpers/publications/pubdsidquery.sql | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) 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