Re: Sort is generating rows

2018-06-11 Thread Adrian Klaver
On 06/10/2018 11:47 PM, Nicolas Seinlet wrote: Hi, a currency rate can have no company, and is then applicable to currencies which have no rate specific for the company. I see. So what happens if, for testing purposes, you eliminate the r.company_id IS NULL OR part? -- Adrian Klaver ad

Re: Sort is generating rows

2018-06-10 Thread Nicolas Seinlet
Hi, a currency rate can have no company, and is then applicable to currencies which have no rate specific for the company. Le dim. 10 juin 2018 à 17:24, Adrian Klaver a écrit : > On 06/05/2018 07:58 AM, Nicolas Seinlet wrote: > > Hi, > > > > I've tried some tests, by generating various datas in

Re: Sort is generating rows

2018-06-10 Thread Adrian Klaver
On 06/05/2018 07:58 AM, Nicolas Seinlet wrote: Hi, I've tried some tests, by generating various datas in the res_currency_rate table. If I generate res_currency_rate rows for unsused currencies, this doesn't influence the execution time. if I generate more res_currency_rate for used currenci

Re: Sort is generating rows

2018-06-05 Thread Nicolas Seinlet
Hi, I've tried some tests, by generating various datas in the res_currency_rate table. If I generate res_currency_rate rows for unsused currencies, this doesn't influence the execution time. if I generate more res_currency_rate for used currencies, this slower the query. If I generate 100 rates,

Re: Sort is generating rows

2018-06-05 Thread Nicolas Seinlet
Hi, you're right, I've also changed the lateral join. The lateral join remove the row generation, and use a loop. I've remove the lateral join, on the same dataset as the one used for provided explain plan, and time to execute grows up to 18s: SELECT min(l.id) AS id, l.product_id, t.uom_i

Re: Sort is generating rows

2018-06-01 Thread Adrian Klaver
On 06/01/2018 02:36 AM, Nicolas Seinlet wrote: Hi, thanks for the answer. The query is based on a view, so here are the view, the query as well as the query plan. I've already taken into account remarks like date ranges. You changed the query from the original, besides just adding the dater

Re: Sort is generating rows

2018-06-01 Thread Nicolas Seinlet
Hi, thanks for the answer. The query is based on a view, so here are the view, the query as well as the query plan. I've already taken into account remarks like date ranges. SELECT min(l.id) AS id, l.product_id, t.uom_id AS product_uom, sum(l.product_uom_qty / u.factor * u2.factor) A

Re: Sort is generating rows

2018-05-31 Thread Adrian Klaver
On 05/31/2018 02:09 AM, Nicolas Seinlet wrote: Hi, I have a query with a strange query plan. This query is roughly searching for sales, and convert them with a currency rate. As currency rate changes from time to time, table contains the currency, the company, the rate, the start date of ava

Sort is generating rows

2018-05-31 Thread Nicolas Seinlet
Hi, I have a query with a strange query plan. This query is roughly searching for sales, and convert them with a currency rate. As currency rate changes from time to time, table contains the currency, the company, the rate, the start date of availability of this rate and the end date of availabil