Re: need clarification on CTE/join

2021-03-24 Thread Marc Millas
Got it :-) thanks ! Marc MILLAS Senior Architect +33607850334 www.mokadb.com On Wed, Mar 24, 2021 at 4:21 AM David G. Johnston < david.g.johns...@gmail.com> wrote: > On Tuesday, March 23, 2021, Marc Millas wrote: > >> Hi, >> >> I cannot agree. >> I did an explain analyze with and without the

Re: need clarification on CTE/join

2021-03-23 Thread David G. Johnston
On Tuesday, March 23, 2021, Marc Millas wrote: > Hi, > > I cannot agree. > I did an explain analyze with and without the cast: its > extremely different: > > postgres=# explain analyze with numb as(select ceiling(2582*random())::int > rand, generate_series(1,5) as monnum) select monnum, prenom fr

Re: need clarification on CTE/join

2021-03-23 Thread Marc Millas
Hi, I cannot agree. I did an explain analyze with and without the cast: its extremely different: postgres=# explain analyze with numb as(select ceiling(2582*random())::int rand, generate_series(1,5) as monnum) select monnum, prenom from numb,prenoms where numb.rand=prenoms.id;

Re: need clarification on CTE/join

2021-03-23 Thread David G. Johnston
On Tue, Mar 23, 2021 at 6:45 PM Marc Millas wrote: > So.. I would like to understand the "why" of this behaviour, ie. the > change of order when I do the cast. > I believe the "why" is immaterial here. Your queries do not contain order by so your results are unordered - even if there appears to