Feed and search query perf tuning (#628)
Switch unnecessary unions to union all in pds queries
This commit is contained in:
parent
50c892c835
commit
f57063bebe
packages/pds/src
@ -42,7 +42,7 @@ export default function (server: Server, ctx: AppContext) {
|
||||
|
||||
const keyset = new FeedKeyset(ref('cursor'), ref('postCid'))
|
||||
let feedItemsQb = db
|
||||
.selectFrom(postsQb.union(repostsQb).as('feed_items'))
|
||||
.selectFrom(postsQb.unionAll(repostsQb).as('feed_items'))
|
||||
.selectAll()
|
||||
feedItemsQb = paginate(feedItemsQb, {
|
||||
limit,
|
||||
|
@ -55,7 +55,7 @@ export default function (server: Server, ctx: AppContext) {
|
||||
|
||||
const keyset = new FeedKeyset(ref('cursor'), ref('postCid'))
|
||||
let feedItemsQb = db
|
||||
.selectFrom(postsQb.union(repostsQb).as('feed_items'))
|
||||
.selectFrom(postsQb.unionAll(repostsQb).as('feed_items'))
|
||||
.selectAll()
|
||||
feedItemsQb = paginate(feedItemsQb, {
|
||||
limit,
|
||||
|
@ -65,8 +65,8 @@ export const getUserSearchQueryPg = (
|
||||
const resultsQb = db.db
|
||||
.selectFrom(
|
||||
emptyQb
|
||||
.union(sql`${accountsQb}`) // The sql`` is adding parens
|
||||
.union(sql`${profilesQb}`)
|
||||
.unionAll(sql`${accountsQb}`) // The sql`` is adding parens
|
||||
.unionAll(sql`${profilesQb}`)
|
||||
.as('accounts_and_profiles'),
|
||||
)
|
||||
.selectAll()
|
||||
|
Loading…
x
Reference in New Issue
Block a user