AW: AW: CTE with JOIN of two tables is much faster than a regular query

2018-08-19 Thread kpi6288
> -Ursprüngliche Nachricht- > Von: Tim Cross > Gesendet: Sonntag, 19. August 2018 04:57 > > > > We're using object mapping / entity frameworks (e.g. XPO, Entity > Framework Core). These frameworks support regular queries out-of-the > box; a CTEs require additional effort and are more diffi

AW: CTE with JOIN of two tables is much faster than a regular query

2018-08-19 Thread kpi6288
> -Ursprüngliche Nachricht- > Von: Tom Lane > Gesendet: Samstag, 18. August 2018 17:29 > > In any case, given that the ILIKE selects so few rows (and the planner knows > it!), finding a way to index that is clearly the right answer. A trigram index took 9 minutes to build but improved th

Re: AW: CTE with JOIN of two tables is much faster than a regular query

2018-08-18 Thread Tim Cross
kpi6...@gmail.com writes: >> -Ursprüngliche Nachricht- >> Von: Ravi Krishna >> Gesendet: Samstag, 18. August 2018 18:25 >> >> > What can I do to improve the performance of the regular query without >> using a CTE? >> >> Why do you care ? When I find that I can write a SQL 3 different

AW: CTE with JOIN of two tables is much faster than a regular query

2018-08-18 Thread kpi6288
> -Ursprüngliche Nachricht- > Von: Ravi Krishna > Gesendet: Samstag, 18. August 2018 18:25 > > > What can I do to improve the performance of the regular query without > using a CTE? > > Why do you care ? When I find that I can write a SQL 3 different ways, I will > go for the most effic

AW: CTE with JOIN of two tables is much faster than a regular query

2018-08-18 Thread kpi6288
> -Ursprüngliche Nachricht- > Von: Tom Lane > Gesendet: Samstag, 18. August 2018 17:29 > > Well, it's simpler than that: filter quals are always evaluated at the lowest > possible plan level. Thank you. This "always" was not clear to me, but it explains a few similar cases (with not-so

AW: CTE with JOIN of two tables is much faster than a regular query

2018-08-18 Thread kpi6288
> -Ursprüngliche Nachricht- > Von: Stephen Frost > Gesendet: Samstag, 18. August 2018 16:39 Hello, > > > What can I do to improve the performance of the regular query without > > using a CTE? > > You could possibly build a trigram index on the field you're searching, which > could avoi

AW: AW: CTE with JOIN of two tables is much faster than a regular query

2018-08-18 Thread kpi6288
> -Ursprüngliche Nachricht- > Von: Adrian Klaver > Gesendet: Samstag, 18. August 2018 16:24 > > To try to replicate what the CTE is doing I would try: > SELECT * > FROM Doc > JOIN (SELECT uDocRef, F.oID, Doc.szText > FROM F JOIN Doc ON F.uDocRef = Doc.udocid) AS D > ON D.uDocRef = D

Re: AW: CTE with JOIN of two tables is much faster than a regular query

2018-08-18 Thread Adrian Klaver
On 08/18/2018 04:08 AM, kpi6...@gmail.com wrote: -Ursprüngliche Nachricht- Von: Andreas Kretschmer Gesendet: Samstag, 18. August 2018 12:27 Am 18.08.2018 um 11:36 schrieb kpi6...@gmail.com: What can I do to improve the performance of the regular query without using a CTE? try t

AW: CTE with JOIN of two tables is much faster than a regular query

2018-08-18 Thread kpi6288
> -Ursprüngliche Nachricht- > Von: Andreas Kretschmer > Gesendet: Samstag, 18. August 2018 12:27 > Am 18.08.2018 um 11:36 schrieb kpi6...@gmail.com: > > What can I do to improve the performance of the regular query without > > using a CTE? > > try to rewrite it to a subselect: > > s