Postgresql 如何为Postgres db使用带TypeForm的横向联接?

Postgresql 如何为Postgres db使用带TypeForm的横向联接?,postgresql,typeorm,Postgresql,Typeorm,我有一个postgres查询,有5个连接,执行这个查询需要10秒以上的时间。我使用横向连接概念重新编写了查询,现在它在不到1秒的时间内执行。我想用typeform编写这个查询,但没有找到任何方法。感谢您的帮助 这是需要转换为TypeORM的查询 FROM "institution" "i" INNER JOIN "financial_account" "fa" ON "fa"."institutionId"="i"."id" left join ( select h1.*

我有一个postgres查询,有5个连接,执行这个查询需要10秒以上的时间。我使用横向连接概念重新编写了查询,现在它在不到1秒的时间内执行。我想用typeform编写这个查询,但没有找到任何方法。感谢您的帮助

这是需要转换为TypeORM的查询

FROM "institution" "i" 
INNER JOIN "financial_account" "fa" ON "fa"."institutionId"="i"."id" 
left join  (
    select h1.*
    from holding as h1
    inner join  (
        select cast(max(h3.holding_date) as DATE) holding_date,h3."accountId"
        From "holding" as h3
        group by h3."accountId"
    ) as h2 on h2."accountId" = h1."accountId" and h2."holding_date" = cast(h1."holding_date" as date)
) "h" on "h"."accountId" = "fa".id
LEFT JOIN "securities" "sec" ON "sec"."id"="h"."securityId"  
LEFT JOIN "symbol" "sym" ON "sym"."id"="sec"."symbolId" AND "sym"."trRIC"="sec"."symbolTrRIC" 
where "i".af_user_id='1234'
ORDER BY "h".institution_value desc;

请显示到目前为止您所做的添加查询。很抱歉,我以前忘记添加它。请显示到目前为止您在添加查询时所做的操作。对不起,我以前忘了加。