Re: Strange behavior of limit clause in complex query

2022-06-08 Thread Justin Pryzby
On Wed, Jun 08, 2022 at 09:44:08AM +0100, Paulo Silva wrote: > But if I add an ORDER BY and a LIMIT something goes very wrong (Q2): A somewhat common problem. A common workaround is to change "ORDER BY a" to something like "ORDER BY a+0" (if your framework will allow it). > An EXPLAIN (ANALYZE,

Re: Strange behavior of limit clause in complex query

2022-06-08 Thread Paulo Silva
Hi, The problem is that the query is generated by the framework, I'm not sure if I can change anything on it. Any other way to influence planner? Regards Ranier Vilela escreveu no dia quarta, 8/06/2022 à(s) 12:40: > Em qua., 8 de jun. de 2022 às 05:44, Paulo Silva > escreveu: > >> Hi, >> >>

Re: Strange behavior of limit clause in complex query

2022-06-08 Thread Ranier Vilela
Em qua., 8 de jun. de 2022 às 05:44, Paulo Silva escreveu: > Hi, > > I'm using PostgreSQL 14.3 and I'm getting strange behavior in a complex > query generated by the Entity Framework. > > The inner (complex) query has a quick execution time: > > # SELECT "Extent1"."id", CAST ("Extent1"."date" AS

Strange behavior of limit clause in complex query

2022-06-08 Thread Paulo Silva
Hi, I'm using PostgreSQL 14.3 and I'm getting strange behavior in a complex query generated by the Entity Framework. The inner (complex) query has a quick execution time: # SELECT "Extent1"."id", CAST ("Extent1"."date" AS timestamp) AS "C3" FROM "dbo"."ng_content" AS "Extent1"