PgHero
2 long running queries
Connections healthy 46
Vacuuming healthy
No columns near integer overflow
No invalid indexes or constraints
No duplicate indexes
6 suggested indexes
58 slow queries

Long Running Queries

We recommend setting a statement timeout on all non-superusers with:

ALTER ROLE <user> SET statement_timeout TO '60s';
Pid Duration State
497985 00:03:05 idle in transaction
odoo
SELECT *
                                       FROM ir_cron
                                       WHERE numbercall != 0
                                          AND active
                                          AND nextcall <= (now() at time zone 'UTC')
                                          AND id=8
                                       FOR UPDATE NOWAIT
498001 00:03:04 idle in transaction
odoo
SELECT "ir_model"."id" as "id","ir_model"."state" as "state","ir_model"."name" as "name","ir_model"."transient" as "transient","ir_model"."create_uid" as "create_uid","ir_model"."write_date" as "write_date","ir_model"."info" as "info","ir_model"."is_mail_thread" as "is_mail_thread","ir_model"."model" as "model","ir_model"."write_uid" as "write_uid","ir_model"."create_date" as "create_date" FROM "ir_model" WHERE "ir_model".id IN (286)

Suggested Indexes

Add indexes to speed up queries.

rails generate migration add_suggested_indexes

And paste

commit_db_transaction
add_index :delivery_dashboard_entry, [:product_id, :id], algorithm: :concurrently
add_index :material_requisition_line, [:product_id], algorithm: :concurrently
add_index :mrp_bom_line, [:product_id], algorithm: :concurrently
add_index :mrp_product_produce_line, [:product_produce_id], algorithm: :concurrently
add_index :order_dispatch, [:state, :create_date], algorithm: :concurrently
add_index :stock_inventory_line, [:prod_lot_id], algorithm: :concurrently

Details
CREATE INDEX CONCURRENTLY ON delivery_dashboard_entry (product_id, id)
Rows: 172516
Row progression: 172516, 183, 0

Row estimates
- product_id (=): 183
- id (sort): 1

Existing indexes
- id PRIMARY
- do_line_id

to speed up

Total Time Average Time Calls
37 min < 0.1% 205 ms 10,781 odoo
SELECT "delivery_dashboard_entry".id FROM "delivery_dashboard_entry" WHERE ("delivery_dashboard_entry"."product_id" in ($1)) ORDER BY "delivery_dashboard_entry"."id"

Details
CREATE INDEX CONCURRENTLY ON material_requisition_line (product_id)
Rows: 32115
Row progression: 32115, 36

Row estimates
- product_id (=): 36
- id (sort): 1

Existing indexes
- id PRIMARY

to speed up

Total Time Average Time Calls
562 min 0.4% 42 ms 804,497 odoo
SELECT "material_requisition_line".id FROM "material_requisition_line" WHERE ("material_requisition_line"."product_id" in ($1)) ORDER BY "material_requisition_line"."id"

Details
CREATE INDEX CONCURRENTLY ON mrp_bom_line (product_id)
Rows: 47194
Row progression: 47194, 15

Row estimates
- product_id (=): 15
- sequence (sort): 1430
- id (sort): 1

Existing indexes
- id PRIMARY
- bom_id

to speed up

Total Time Average Time Calls
41 min < 0.1% 46 ms 53,915 odoo
SELECT "mrp_bom_line".id FROM "mrp_bom_line" WHERE ("mrp_bom_line"."product_id" in ($1)) ORDER BY "mrp_bom_line"."sequence" ,"mrp_bom_line"."id"

Details
CREATE INDEX CONCURRENTLY ON mrp_product_produce_line (product_produce_id)
Rows: 164365
Row progression: 164365, 8

Row estimates
- product_produce_id (=): 8
- id (sort): 1

Existing indexes
- id PRIMARY

to speed up

Total Time Average Time Calls
34 min < 0.1% 54 ms 37,272 odoo
SELECT "mrp_product_produce_line".id FROM "mrp_product_produce_line" WHERE ("mrp_product_produce_line"."product_produce_id" in ($1)) ORDER BY "mrp_product_produce_line"."id"

Details
CREATE INDEX CONCURRENTLY ON order_dispatch (state, create_date)
Rows: 34502
Row progression: 34502, 11500, 0

Row estimates
- state (=): 11500
- create_date (sort): 1

Existing indexes
- id PRIMARY

to speed up

Total Time Average Time Calls
54 min < 0.1% 22 ms 145,040 odoo
SELECT "order_dispatch".id FROM "order_dispatch" WHERE ("order_dispatch"."state" = $1) ORDER BY "order_dispatch"."create_date" DESC  limit $2

Details
CREATE INDEX CONCURRENTLY ON stock_inventory_line (prod_lot_id)
Rows: 95423
Row progression: 95423, 2

Row estimates
- prod_lot_id (=): 2
- id (sort): 1

Existing indexes
- id PRIMARY
- company_id
- inventory_id
- location_id
- package_id
- product_id

to speed up

Total Time Average Time Calls
87 min < 0.1% 253 ms 20,562 odoo
SELECT "stock_inventory_line".id FROM "stock_inventory_line" WHERE ("stock_inventory_line"."prod_lot_id" in ($1)) ORDER BY "stock_inventory_line"."id"

Slow Queries

Slow queries take 20 ms or more on average and have been called at least 100 times.

Explain queries to see where to add indexes.

Total Time Average Time Calls
70,989 min 48% 7,240 ms 588,287 odoo
SELECT "stock_move".id FROM "stock_move" LEFT JOIN "stock_picking" as "stock_move__picking_id" ON ("stock_move"."picking_id" = "stock_move__picking_id"."id") WHERE (("stock_move"."scrapped" IS NULL or "stock_move"."scrapped" = $1 )  AND  ("stock_move"."raw_material_production_id" in ($2))) ORDER BY "stock_move__picking_id"."priority" DESC,"stock_move__picking_id"."date" ASC,"stock_move__picking_id"."id" DESC,"stock_move"."sequence" ,"stock_move"."id"
15,518 min 10% 9,280 ms 100,335 odoo
SELECT "stock_move".id FROM "stock_move" LEFT JOIN "stock_picking" as "stock_move__picking_id" ON ("stock_move"."picking_id" = "stock_move__picking_id"."id") WHERE (("stock_move"."scrapped" IS NULL or "stock_move"."scrapped" = $1 )  AND  ("stock_move"."production_id" in ($2))) ORDER BY "stock_move__picking_id"."priority" DESC,"stock_move__picking_id"."date" ASC,"stock_move__picking_id"."id" DESC,"stock_move"."sequence" ,"stock_move"."id"
12,624 min 8% 5,891 ms 128,564 odoo
SELECT "product_product".id FROM "product_template" as "product_product__product_tmpl_id","product_product" WHERE ("product_product"."product_tmpl_id"="product_product__product_tmpl_id"."id") AND ((("product_product"."active" = $1)  AND  ("product_product__product_tmpl_id"."id" in (WITH temp_irt_current (id, name) as (
                            SELECT ct.id, coalesce(it.value,ct."name")
                            FROM product_template ct
                            LEFT JOIN ir_translation it ON (it.name = $2 and
                                        it.lang = $3 and
                                        it.type = $4 and
                                        it.res_id = ct.id and
                                        it.value != $5)
                            )
                            SELECT id FROM temp_irt_current WHERE name ilike $6 order by name
                            )))  AND  ($7 OR "product_product"."id" IS NULL)) ORDER BY "product_product"."default_code" ,"product_product"."id"   limit $8
11,666 min 8% 12,215 ms 57,305 odoo
SELECT "stock_move".id FROM "stock_move" LEFT JOIN "stock_picking" as "stock_move__picking_id" ON ("stock_move"."picking_id" = "stock_move__picking_id"."id"),"stock_location" as "stock_move__location_dest_id" WHERE ("stock_move"."inventory_id" in ($1)) AND ("stock_move"."location_dest_id"="stock_move__location_dest_id"."id") AND (("stock_move"."company_id" IS NULL   OR  ("stock_move"."company_id" in ($2)))  OR  "stock_move__location_dest_id"."company_id" IS NULL ) ORDER BY "stock_move__picking_id"."priority" DESC,"stock_move__picking_id"."date" ASC,"stock_move__picking_id"."id" DESC,"stock_move"."sequence" ,"stock_move"."id"
6,979 min 5% 584 ms 716,632 odoo
SELECT "queue_job".id FROM "queue_job" WHERE ((("queue_job"."state" = $1)  AND  ("queue_job"."date_created" > $2))  AND  (("queue_job"."name" not in ($3,$4,$5,$6,$7,$8,$9)) OR "queue_job"."name" IS NULL)) ORDER BY "queue_job"."date_created"
5,313 min 4% 509 ms 626,374 odoo
SELECT "queue_job".id FROM "queue_job" WHERE ((("queue_job"."state" = $1)  AND  ("queue_job"."date_created" > $2))  AND  ("queue_job"."name" in ($3,$4,$5,$6,$7))) ORDER BY "queue_job"."date_created"
Covered by index on (name, date_created)
Rows: 502652
Row progression: 502652, 23936, 2394

Row estimates
- name (=): 23936
- date_created (>): 50265
- state (=): 125663
- date_created (sort): 2

Existing indexes
- id PRIMARY
- channel
- company_id
- identity_key WHERE ((state)::text = ANY (ARRAY[('pending'::character varying)::text, ('enqueued'::character varying)::text])) AND (identity_key IS NOT NULL)
- name, date_created
- state
- uuid
3,564 min 2% 11,149 ms 19,182 odoo
SELECT "stock_move".id FROM "stock_move" LEFT JOIN "stock_picking" as "stock_move__picking_id" ON ("stock_move"."picking_id" = "stock_move__picking_id"."id") WHERE ("stock_move"."sale_line_id" in ($1)) ORDER BY "stock_move__picking_id"."priority" DESC,"stock_move__picking_id"."date" ASC,"stock_move__picking_id"."id" DESC,"stock_move"."sequence" ,"stock_move"."id"
3,526 min 2% 11,219 ms 18,859 odoo
SELECT "stock_move".id FROM "stock_move" LEFT JOIN "stock_picking" as "stock_move__picking_id" ON ("stock_move"."picking_id" = "stock_move__picking_id"."id") WHERE ("stock_move"."sale_line_id" in ($1,$2)) ORDER BY "stock_move__picking_id"."priority" DESC,"stock_move__picking_id"."date" ASC,"stock_move__picking_id"."id" DESC,"stock_move"."sequence" ,"stock_move"."id"
2,456 min 2% 4,545 ms 32,421 odoo
SELECT min("sale_report".id) AS id, count("sale_report".id) AS "product_id_count" , sum("sale_report"."product_uom_qty") AS "product_uom_qty" ,"sale_report"."product_id" as "product_id" 
            FROM "sale_report" LEFT JOIN "product_product" as "sale_report__product_id" ON ("sale_report"."product_id" = "sale_report__product_id"."id")
            WHERE (("sale_report"."state" in ($1,$2))  AND  ("sale_report"."product_id" in ($3))) AND ("sale_report"."company_id" IS NULL   OR  ("sale_report"."company_id" in ($4)))
            GROUP BY "sale_report"."product_id","sale_report__product_id"."default_code","sale_report__product_id"."id"
            ORDER BY  "sale_report__product_id"."default_code" ,"sale_report__product_id"."id"
1,745 min 1% 10,664 ms 9,816 odoo
SELECT "stock_move".id FROM "stock_move" LEFT JOIN "stock_picking" as "stock_move__picking_id" ON ("stock_move"."picking_id" = "stock_move__picking_id"."id") WHERE ("stock_move"."sale_line_id" in ($1,$2,$3)) ORDER BY "stock_move__picking_id"."priority" DESC,"stock_move__picking_id"."date" ASC,"stock_move__picking_id"."id" DESC,"stock_move"."sequence" ,"stock_move"."id"
1,461 min 1.0% 191 ms 459,617 odoo
UPDATE "product_product" SET "write_uid"=$1,"write_date"=(now() at time zone $2) WHERE id IN ($3)
Covered by index on (id)
Rows: 1000206
Row progression: 1000206, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active, default_code
- barcode UNIQUE
- default_code
- product_tmpl_id
1,317 min 0.9% 443 ms 178,354 odoo
SELECT "account_invoice".id FROM "account_invoice" WHERE ((("account_invoice"."origin"::text like $1)  AND  ("account_invoice"."company_id" = $2))  AND  ("account_invoice"."type" in ($3,$4))) ORDER BY "account_invoice"."date_invoice" DESC,"account_invoice"."number" DESC,"account_invoice"."id" DESC
1,295 min 0.9% 258 ms 301,304 odoo
SELECT "product_product".id FROM "product_template" as "product_product__product_tmpl_id","product_product" WHERE ("product_product"."product_tmpl_id"="product_product__product_tmpl_id"."id") AND (("product_product"."active" = $1)  AND  ("product_product__product_tmpl_id"."id" in (WITH temp_irt_current (id, name) as (
                            SELECT ct.id, coalesce(it.value,ct."name")
                            FROM product_template ct
                            LEFT JOIN ir_translation it ON (it.name = $2 and
                                        it.lang = $3 and
                                        it.type = $4 and
                                        it.res_id = ct.id and
                                        it.value != $5)
                            )
                            SELECT id FROM temp_irt_current WHERE name = $6 order by name
                            ))) ORDER BY "product_product"."default_code" ,"product_product"."id"   limit $7
908 min 0.6% 11,759 ms 4,634 odoo
SELECT "stock_move".id FROM "stock_move" LEFT JOIN "stock_picking" as "stock_move__picking_id" ON ("stock_move"."picking_id" = "stock_move__picking_id"."id") WHERE (("stock_move"."scrapped" IS NULL or "stock_move"."scrapped" = $1 )  AND  ("stock_move"."raw_material_production_id" in ($2,$3))) ORDER BY "stock_move__picking_id"."priority" DESC,"stock_move__picking_id"."date" ASC,"stock_move__picking_id"."id" DESC,"stock_move"."sequence" ,"stock_move"."id"
897 min 0.6% 10,594 ms 5,080 odoo
SELECT "stock_move".id FROM "stock_move" LEFT JOIN "stock_picking" as "stock_move__picking_id" ON ("stock_move"."picking_id" = "stock_move__picking_id"."id") WHERE ("stock_move"."sale_line_id" in ($1,$2,$3,$4)) ORDER BY "stock_move__picking_id"."priority" DESC,"stock_move__picking_id"."date" ASC,"stock_move__picking_id"."id" DESC,"stock_move"."sequence" ,"stock_move"."id"
562 min 0.4% 42 ms 804,497 odoo
SELECT "material_requisition_line".id FROM "material_requisition_line" WHERE ("material_requisition_line"."product_id" in ($1)) ORDER BY "material_requisition_line"."id"
Details
CREATE INDEX CONCURRENTLY ON material_requisition_line (product_id)
Rows: 32115
Row progression: 32115, 36

Row estimates
- product_id (=): 36
- id (sort): 1

Existing indexes
- id PRIMARY
320 min 0.2% 3,118 ms 6,163 odoo
UPDATE "material_requisition" SET "state"=$1,"write_uid"=$2,"write_date"=(now() at time zone $3) WHERE id IN ($4)
Covered by index on (id)
Rows: 807
Row progression: 807, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
299 min 0.2% 5,243 ms 3,423 odoo
SELECT min("mrp_production".id) AS id, count("mrp_production".id) AS "picking_type_id_count" , "mrp_production"."picking_type_id" as "picking_type_id" 
            FROM "mrp_production" LEFT JOIN "stock_picking_type" as "mrp_production__picking_type_id" ON ("mrp_production"."picking_type_id" = "mrp_production__picking_type_id"."id")
            WHERE ((("mrp_production"."availability" = $1)  AND  (("mrp_production"."state" not in ($2,$3)) OR "mrp_production"."state" IS NULL))  AND  ("mrp_production"."picking_type_id" in ($4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38))) AND (("mrp_production"."company_id" in ($39))  OR  "mrp_production"."company_id" IS NULL )
            GROUP BY "mrp_production"."picking_type_id","mrp_production__picking_type_id"."sequence","mrp_production__picking_type_id"."id"
            ORDER BY  "mrp_production__picking_type_id"."sequence" ,"mrp_production__picking_type_id"."id"
244 min 0.2% 4,279 ms 3,423 odoo
SELECT min("mrp_production".id) AS id, count("mrp_production".id) AS "picking_type_id_count" , "mrp_production"."picking_type_id" as "picking_type_id" 
            FROM "mrp_production" LEFT JOIN "stock_picking_type" as "mrp_production__picking_type_id" ON ("mrp_production"."picking_type_id" = "mrp_production__picking_type_id"."id")
            WHERE ((("mrp_production"."state" in ($1,$2,$3))  AND  (("mrp_production"."state" not in ($4,$5)) OR "mrp_production"."state" IS NULL))  AND  ("mrp_production"."picking_type_id" in ($6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40))) AND (("mrp_production"."company_id" in ($41))  OR  "mrp_production"."company_id" IS NULL )
            GROUP BY "mrp_production"."picking_type_id","mrp_production__picking_type_id"."sequence","mrp_production__picking_type_id"."id"
            ORDER BY  "mrp_production__picking_type_id"."sequence" ,"mrp_production__picking_type_id"."id"
212 min 0.1% 1,246 ms 10,197 odoo
SELECT "sale_order".id FROM "sale_order" WHERE ((("sale_order"."partner_id" = $1)  AND  ("sale_order"."brand_id" = $2))  AND  ("sale_order"."create_date" < $3)) ORDER BY "sale_order"."date_order" DESC,"sale_order"."id" DESC  limit $4
Covered by index on (partner_id)
Rows: 790297
Row progression: 790297, 8

Row estimates
- partner_id (=): 8
- brand_id (=): 10399
- create_date (<): 79030
- date_order (sort): 1

Existing indexes
- id PRIMARY
- brand_id
- code
- confirmation_date
- create_date
- date_order
- deliverect_id UNIQUE
- dh_token UNIQUE
- fo_state
- instashop_id UNIQUE
- name
- partner_id
- platform_id
- state
- user_id
- zomato_id UNIQUE
206 min 0.1% 21 ms 602,584 odoo
SELECT "product_uom".id FROM "product_uom" WHERE (("product_uom"."active" = $1)  AND  ("product_uom"."id" in (WITH temp_irt_current (id, name) as (
                            SELECT ct.id, coalesce(it.value,ct."name")
                            FROM product_uom ct
                            LEFT JOIN ir_translation it ON (it.name = $2 and
                                        it.lang = $3 and
                                        it.type = $4 and
                                        it.res_id = ct.id and
                                        it.value != $5)
                            )
                            SELECT id FROM temp_irt_current WHERE name = $6 order by name
                            ))) ORDER BY "product_uom"."name"   limit $7
203 min 0.1% 3,558 ms 3,423 odoo
SELECT min("mrp_production".id) AS id, count("mrp_production".id) AS "picking_type_id_count" , "mrp_production"."picking_type_id" as "picking_type_id" 
            FROM "mrp_production" LEFT JOIN "stock_picking_type" as "mrp_production__picking_type_id" ON ("mrp_production"."picking_type_id" = "mrp_production__picking_type_id"."id")
            WHERE (((("mrp_production"."date_planned_start" < $1)  AND  ("mrp_production"."state" = $2))  AND  (("mrp_production"."state" not in ($3,$4)) OR "mrp_production"."state" IS NULL))  AND  ("mrp_production"."picking_type_id" in ($5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39))) AND (("mrp_production"."company_id" in ($40))  OR  "mrp_production"."company_id" IS NULL )
            GROUP BY "mrp_production"."picking_type_id","mrp_production__picking_type_id"."sequence","mrp_production__picking_type_id"."id"
            ORDER BY  "mrp_production__picking_type_id"."sequence" ,"mrp_production__picking_type_id"."id"
157 min 0.1% 73 ms 128,564 odoo
SELECT "product_product".id FROM "product_product" WHERE (("product_product"."active" = $1)  AND  ("product_product"."default_code"::text ilike $2)) ORDER BY "product_product"."default_code" ,"product_product"."id"   limit $3
154 min 0.1% 18,713 ms 493 odoo
SELECT "stock_move".id FROM "stock_move" LEFT JOIN "stock_picking" as "stock_move__picking_id" ON ("stock_move"."picking_id" = "stock_move__picking_id"."id"),"stock_location" as "stock_move__location_dest_id" WHERE (("stock_move"."scrapped" IS NULL or "stock_move"."scrapped" = $1 )  AND  ("stock_move"."raw_material_production_id" in ($2))) AND ("stock_move"."location_dest_id"="stock_move__location_dest_id"."id") AND (("stock_move"."company_id" IS NULL   OR  ("stock_move"."company_id" in ($3)))  OR  "stock_move__location_dest_id"."company_id" IS NULL ) ORDER BY "stock_move__picking_id"."priority" DESC,"stock_move__picking_id"."date" ASC,"stock_move__picking_id"."id" DESC,"stock_move"."sequence" ,"stock_move"."id"
131 min < 0.1% 16,980 ms 463 odoo
SELECT min("stock_move".id) AS id, count("stock_move".id) AS "product_id_count" , sum("stock_move"."product_qty") AS "product_qty" ,"stock_move"."product_id" as "product_id" 
            FROM "stock_location" as "stock_move__location_dest_id","stock_location" as "stock_move__location_id","stock_move"
            WHERE ("stock_move"."location_dest_id"="stock_move__location_dest_id"."id" AND "stock_move"."location_id"="stock_move__location_id"."id") AND ((((("stock_move"."state" not in ('done','cancel','draft')) OR "stock_move"."state" IS NULL)  AND  ("stock_move"."product_id" in (1022520,1004893,1004894,1005024,1005250,1005254,1005258,1005570,1005571,1005583,1006438,960282,889236,889239,889242,889278,889310,889350,889369,1006704,1006772,1006773,889555,889570,1007671,889638,1007674,1007776,981124,889650,1007785,981128,960514,960518,889675,889680,889687,889696,981201,981203,981205,981210,981217,890123,890131,890134,890142,890149,890152,981255,890165,890419,890430,890468,981281,890479,981284,981287,981291,981292,981322,981324,981325,981327,981328,981329,981332,981463,981464,981465,981467,1010202,981478,981483,981488,890979,890987,891003,981563,981565,981569,981571,981573,981577,892007,946062,946075,946076,946078,946080,946087,981849,981851,981852,981871,946154,946160,946166,946169,946178,981918,981921,946295,883071,982059,982108,982211,982237,982243,982245,982343,894615,982405,900718,901024,982454,901418,982518,1017515,1017680,1017683,982548,967065,902460,1018626,982582,982642,1018677,982650,982656,982694,983195,983197,1018755,983247,983253,983258,983271,983288,1018788,1018794,983363,983365,983372,983387,983388,983396,983404,983406,983416,983432,1018823,983486,983493,1018844,983638,905268,1018847,1018848,1018849,983646,1018850,983647,983711,983722,983778,983803,1021485,983823,1018883,983841,1018922,1018929,1018930,1019052,1019097,1019110,1019128,1019133,1019135,1019136,1019137,1019138,1019145,1019146,767640,1019149,1019156,1019159,1019166,1019170,1019177,1019178,1019181,1019183,1019184,1019185,1019186,1019213,1019214,1019329,1019340,1019352,1019367,1019376,1019381,1019446,1019447,1019450,984083,1019493,1019510,1019520,1019524,1019531,1019534,1021881,1021882,984294,984295,984296,1021885,984309,984324,1021891,1021894,984596,984597,984598,984599,984620,1021898,984638,984639,984760,984762,984784,984795,985149,985158,985162,985169,985184,985377,985385,985389,985523,985534,985677,985696,985735,985749,985756,985758,985759,985763,985772,985877,985887,985907,978503,986080,986120,1022922,986489,986699,986700,986701,986703,986704,979343,986975,986981,986982,987057,987058,987360,987363,987370,987371,987372,987373,987637,979383,979395,988150,988183,979411,988880,989752,989772,989831,991769,878758,878983,878990,979671,879786,879833,879841,926511,993599,927920,993644,879902,993995,879934,994060,980660,880883,880888,910992,881344,881345,979819,979821,979825,881370,979829,979836,979838,881420,881738,881751,881781,979885,994506,930548,881838,881844,994533,994547,882282,882287,994688,994693,1023605,994699,994704,1023608,994714,994715,882986,883022,995523,995565,1020280,1020400,1021470,1021471,995892,1021472,1021475,1021480,996654,1021483,1021484,1021482,1021486,1021487,1021488,1021489,996881,1021494,1021495,1021496,1021493,1021498,1021499,1021500,1021501,1021502,1021503,1021506,996892,1021508,1021507,1021510,996896,1021517,1021516,1021873,1021874,1021875,1021876,1021877,1021878,1021879,1021880,980438,980435,1021883,1021884,996925,1021886,1021887,1021888,980455,1021890,1021889,1021892,1021893,980457,1021895,980463,1021897,1021896,1021899,1021900,1021901,997835,1021902,1021904,1021905,1021903,980489,885705,1022118,1022119,1021906,1022514,1022518,1022521,1022523,886249,1022527,1022529,1022530,1022531,1022532,1022533,1022534,1022535,1022537,1022538,1022539,1022540,886272,1022542,1022547,1022548,1022551,1022552,886312,1022555,886303,1022556,1022559,1022560,1022561,1022597,1022557,1022695,980547,886386,1022781,1022868,1022869,951003,1022598,1022953,951006,951005,1022957,1022962,951009,951008,1022965,886461,1022955,886555,1022970,1022971,980582,1022973,1022974,1022976,1023017,1023020,1023021,1023022,1023023,1023024,1023025,1023026,935163,1023028,1023029,1023067,1023027,1023071,1023115,1023195,1023198,1023202,1023205,1023206,1023207,1023208,1023261,1023262,1023263,1023265,1023425,1023583,1023587,1023589,1023590,887148,1023594,1023601,1023603,887161,1023604,980656,953083,1023607,953091,953098,1023616,1023618,1023619,1023620,1023621,980679,1023609,1023625,1023612,980676,1023630,1023631,1023632,1023633,1023636,980694,1023639,1023640,1023641,1023644,1023645,887342,1023648,1023647,1023656,1023655,1023658,1023657,1023793,1023794,1023804,1023808,1023814,1023817,887389,1024059,1023849,1023850,1023852,998629,1023920,1024016,1023876,1024060,980760,1000097,1024106,1024110,1024111,1024112,1024109,999913,1024254,1024260,1024278,1000716,1024280,1024281,1024289,1024290,1024292,1024300,1000856,1024316,1024329,887456,1024328,1024340,1024331,980862,1024339,1001036,1024360,1024384,1024385,980866,1024367,1024369,980873,1025274,1025294,980881,980892,980896,980899,980902,888006,1024288,980924,980925,980931,888068,1002460,980938,1002668,1002877,980965,1003708,1003712,1003713,888180,888185,1004889,1004890,1004891,1004892)))  AND  (((((("stock_move__location_dest_id"."parent_left" >= 88)  AND  ("stock_move__location_dest_id"."parent_left" < 89))  OR  (("stock_move__location_dest_id"."parent_left" >= 746)  AND  ("stock_move__location_dest_id"."parent_left" < 747)))  OR  (("stock_move__location_dest_id"."parent_left" >= 748)  AND  ("stock_move__location_dest_id"."parent_left" < 749)))  OR  (("stock_move__location_dest_id"."parent_left" >= 750)  AND  ("stock_move__location_dest_id"."parent_left" < 751)))  OR  ("stock_move"."location_dest_id" in (605))))  AND  (((((("stock_move__location_id"."parent_left" < 88)  OR  ("stock_move__location_id"."parent_left" >= 89))  AND  (("stock_move__location_id"."parent_left" < 746)  OR  ("stock_move__location_id"."parent_left" >= 747)))  AND  (("stock_move__location_id"."parent_left" < 748)  OR  ("stock_move__location_id"."parent_left" >= 749)))  AND  (("stock_move__location_id"."parent_left" < 750)  OR  ("stock_move__location_id"."parent_left" >= 751)))  AND  (NOT (("stock_move"."location_id" in (605))))))
            GROUP BY "stock_move"."product_id"
            ORDER BY "id"
126 min < 0.1% 16,389 ms 460 odoo
SELECT min("stock_move".id) AS id, count("stock_move".id) AS "product_id_count" , sum("stock_move"."product_qty") AS "product_qty" ,"stock_move"."product_id" as "product_id" 
            FROM "stock_location" as "stock_move__location_id","stock_location" as "stock_move__location_dest_id","stock_move"
            WHERE ("stock_move"."location_dest_id"="stock_move__location_dest_id"."id" AND "stock_move"."location_id"="stock_move__location_id"."id") AND ((((("stock_move"."state" not in ($1,$2,$3)) OR "stock_move"."state" IS NULL)  AND  ("stock_move"."product_id" in ($4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$80,$81,$82,$83,$84,$85,$86,$87,$88,$89,$90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$100,$101,$102,$103,$104,$105,$106,$107,$108,$109,$110,$111,$112,$113,$114,$115,$116,$117,$118,$119,$120,$121,$122,$123,$124,$125,$126,$127,$128,$129,$130,$131,$132,$133,$134,$135,$136,$137,$138,$139,$140,$141,$142,$143,$144,$145,$146,$147,$148,$149,$150,$151,$152,$153,$154,$155,$156,$157,$158,$159,$160,$161,$162,$163,$164,$165,$166,$167,$168,$169,$170,$171,$172,$173,$174,$175,$176,$177,$178,$179,$180,$181,$182,$183,$184,$185,$186,$187,$188,$189,$190,$191,$192,$193,$194,$195,$196,$197,$198,$199,$200,$201,$202,$203,$204,$205,$206,$207,$208,$209,$210,$211,$212,$213,$214,$215,$216,$217,$218,$219,$220,$221,$222,$223,$224,$225,$226,$227,$228,$229,$230,$231,$232,$233,$234,$235,$236,$237,$238,$239,$240,$241,$242,$243,$244,$245,$246,$247,$248,$249,$250,$251,$252,$253,$254,$255,$256,$257,$258,$259,$260,$261,$262,$263,$264,$265,$266,$267,$268,$269,$270,$271,$272,$273,$274,$275,$276,$277,$278,$279,$280,$281,$282,$283,$284,$285,$286,$287,$288,$289,$290,$291,$292,$293,$294,$295,$296,$297,$298,$299,$300,$301,$302,$303,$304,$305,$306,$307,$308,$309,$310,$311,$312,$313,$314,$315,$316,$317,$318,$319,$320,$321,$322,$323,$324,$325,$326,$327,$328,$329,$330,$331,$332,$333,$334,$335,$336,$337,$338,$339,$340,$341,$342,$343,$344,$345,$346,$347,$348,$349,$350,$351,$352,$353,$354,$355,$356,$357,$358,$359,$360,$361,$362,$363,$364,$365,$366,$367,$368,$369,$370,$371,$372,$373,$374,$375,$376,$377,$378,$379,$380,$381,$382,$383,$384,$385,$386,$387,$388,$389,$390,$391,$392,$393,$394,$395,$396,$397,$398,$399,$400,$401,$402,$403,$404,$405,$406,$407,$408,$409,$410,$411,$412,$413,$414,$415,$416,$417,$418,$419,$420,$421,$422,$423,$424,$425,$426,$427,$428,$429,$430,$431,$432,$433,$434,$435,$436,$437,$438,$439,$440,$441,$442,$443,$444,$445,$446,$447,$448,$449,$450,$451,$452,$453,$454,$455,$456,$457,$458,$459,$460,$461,$462,$463,$464,$465,$466,$467,$468,$469,$470,$471,$472,$473,$474,$475,$476,$477,$478,$479,$480,$481,$482,$483,$484,$485,$486,$487,$488,$489,$490,$491,$492,$493,$494,$495,$496,$497,$498,$499,$500,$501,$502,$503,$504,$505,$506,$507,$508,$509,$510,$511,$512,$513,$514,$515,$516,$517,$518,$519,$520,$521,$522,$523,$524,$525,$526,$527,$528,$529,$530,$531,$532,$533,$534,$535,$536,$537,$538,$539,$540,$541,$542,$543,$544,$545,$546,$547,$548,$549,$550,$551,$552,$553,$554,$555,$556,$557,$558,$559,$560,$561,$562,$563,$564,$565,$566,$567,$568,$569,$570,$571,$572,$573,$574,$575,$576,$577,$578,$579,$580,$581,$582,$583,$584,$585,$586,$587,$588,$589,$590,$591,$592,$593,$594,$595,$596,$597,$598,$599,$600,$601,$602,$603,$604,$605,$606,$607,$608,$609,$610,$611,$612,$613,$614,$615,$616,$617,$618,$619,$620,$621,$622,$623,$624,$625,$626,$627,$628)))  AND  (((((("stock_move__location_id"."parent_left" >= $629)  AND  ("stock_move__location_id"."parent_left" < $630))  OR  (("stock_move__location_id"."parent_left" >= $631)  AND  ("stock_move__location_id"."parent_left" < $632)))  OR  (("stock_move__location_id"."parent_left" >= $633)  AND  ("stock_move__location_id"."parent_left" < $634)))  OR  (("stock_move__location_id"."parent_left" >= $635)  AND  ("stock_move__location_id"."parent_left" < $636)))  OR  ("stock_move"."location_id" in ($637))))  AND  (((((("stock_move__location_dest_id"."parent_left" < $638)  OR  ("stock_move__location_dest_id"."parent_left" >= $639))  AND  (("stock_move__location_dest_id"."parent_left" < $640)  OR  ("stock_move__location_dest_id"."parent_left" >= $641)))  AND  (("stock_move__location_dest_id"."parent_left" < $642)  OR  ("stock_move__location_dest_id"."parent_left" >= $643)))  AND  (("stock_move__location_dest_id"."parent_left" < $644)  OR  ("stock_move__location_dest_id"."parent_left" >= $645)))  AND  (NOT (("stock_move"."location_dest_id" in ($646))))))
            GROUP BY "stock_move"."product_id"
            ORDER BY "id"
124 min < 0.1% 15,943 ms 467 odoo
SELECT min("stock_move".id) AS id, count("stock_move".id) AS "product_id_count" , sum("stock_move"."product_qty") AS "product_qty" ,"stock_move"."product_id" as "product_id" 
            FROM "stock_location" as "stock_move__location_id","stock_location" as "stock_move__location_dest_id","stock_move"
            WHERE ("stock_move"."location_dest_id"="stock_move__location_dest_id"."id" AND "stock_move"."location_id"="stock_move__location_id"."id") AND ((((("stock_move"."state" not in ($1,$2,$3)) OR "stock_move"."state" IS NULL)  AND  ("stock_move"."product_id" in ($4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$80,$81,$82,$83,$84,$85,$86,$87,$88,$89,$90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$100,$101,$102,$103,$104,$105,$106,$107,$108,$109,$110,$111,$112,$113,$114,$115,$116,$117,$118,$119,$120,$121,$122,$123,$124,$125,$126,$127,$128,$129,$130,$131,$132,$133,$134,$135,$136,$137,$138,$139,$140,$141,$142,$143,$144,$145,$146,$147,$148,$149,$150,$151,$152,$153,$154,$155,$156,$157,$158,$159,$160,$161,$162,$163,$164,$165,$166,$167,$168,$169,$170,$171,$172,$173,$174,$175,$176,$177,$178,$179,$180,$181,$182,$183,$184,$185,$186,$187,$188,$189,$190,$191,$192,$193,$194,$195,$196,$197,$198,$199,$200,$201,$202,$203,$204,$205,$206,$207,$208,$209,$210,$211,$212,$213,$214,$215,$216,$217,$218,$219,$220,$221,$222,$223,$224,$225,$226,$227,$228,$229,$230,$231,$232,$233,$234,$235,$236,$237,$238,$239,$240,$241,$242,$243,$244,$245,$246,$247,$248,$249,$250,$251,$252,$253,$254,$255,$256,$257,$258,$259,$260,$261,$262,$263,$264,$265,$266,$267,$268,$269,$270,$271,$272,$273,$274,$275,$276,$277,$278,$279,$280,$281,$282,$283,$284,$285,$286,$287,$288,$289,$290,$291,$292,$293,$294,$295,$296,$297,$298,$299,$300,$301,$302,$303,$304,$305,$306,$307,$308,$309,$310,$311,$312,$313,$314,$315,$316,$317,$318,$319,$320,$321,$322,$323,$324,$325,$326,$327,$328,$329,$330,$331,$332,$333,$334,$335,$336,$337,$338,$339,$340,$341,$342,$343,$344,$345,$346,$347,$348,$349,$350,$351,$352,$353,$354,$355,$356,$357,$358,$359,$360,$361,$362,$363,$364,$365,$366,$367,$368,$369,$370,$371,$372,$373,$374,$375,$376,$377,$378,$379,$380,$381,$382,$383,$384,$385,$386,$387,$388,$389,$390,$391,$392,$393,$394,$395,$396,$397,$398,$399,$400,$401,$402,$403,$404,$405,$406,$407,$408,$409,$410,$411,$412,$413,$414,$415,$416,$417,$418,$419,$420,$421,$422,$423,$424,$425,$426,$427,$428,$429,$430,$431,$432,$433,$434,$435,$436,$437,$438,$439,$440,$441,$442,$443,$444,$445,$446,$447,$448,$449,$450,$451,$452,$453,$454,$455,$456,$457,$458,$459,$460,$461,$462,$463,$464,$465,$466,$467,$468,$469,$470,$471,$472,$473,$474,$475,$476,$477,$478,$479,$480,$481,$482,$483,$484,$485,$486,$487,$488,$489,$490,$491,$492,$493,$494,$495,$496,$497,$498,$499,$500,$501,$502,$503,$504,$505,$506,$507,$508,$509,$510,$511,$512,$513,$514,$515,$516,$517,$518,$519,$520,$521,$522,$523,$524,$525,$526,$527,$528,$529,$530,$531,$532,$533,$534,$535,$536,$537,$538,$539,$540,$541,$542,$543,$544,$545,$546,$547,$548,$549,$550,$551,$552,$553,$554,$555,$556,$557,$558,$559,$560,$561,$562,$563,$564,$565,$566,$567,$568,$569,$570,$571,$572,$573,$574,$575,$576,$577,$578,$579,$580,$581,$582,$583,$584,$585,$586,$587,$588,$589,$590,$591,$592,$593,$594,$595,$596,$597,$598,$599,$600,$601,$602,$603,$604,$605,$606,$607,$608,$609,$610,$611,$612,$613,$614,$615,$616,$617,$618,$619,$620,$621,$622,$623,$624,$625,$626,$627,$628)))  AND  ((((((((((((("stock_move__location_id"."parent_left" >= $629)  AND  ("stock_move__location_id"."parent_left" < $630))  OR  (("stock_move__location_id"."parent_left" >= $631)  AND  ("stock_move__location_id"."parent_left" < $632)))  OR  (("stock_move__location_id"."parent_left" >= $633)  AND  ("stock_move__location_id"."parent_left" < $634)))  OR  (("stock_move__location_id"."parent_left" >= $635)  AND  ("stock_move__location_id"."parent_left" < $636)))  OR  (("stock_move__location_id"."parent_left" >= $637)  AND  ("stock_move__location_id"."parent_left" < $638)))  OR  (("stock_move__location_id"."parent_left" >= $639)  AND  ("stock_move__location_id"."parent_left" < $640)))  OR  (("stock_move__location_id"."parent_left" >= $641)  AND  ("stock_move__location_id"."parent_left" < $642)))  OR  (("stock_move__location_id"."parent_left" >= $643)  AND  ("stock_move__location_id"."parent_left" < $644)))  OR  (("stock_move__location_id"."parent_left" >= $645)  AND  ("stock_move__location_id"."parent_left" < $646)))  OR  (("stock_move__location_id"."parent_left" >= $647)  AND  ("stock_move__location_id"."parent_left" < $648)))  OR  (("stock_move__location_id"."parent_left" >= $649)  AND  ("stock_move__location_id"."parent_left" < $650)))  OR  (("stock_move__location_id"."parent_left" >= $651)  AND  ("stock_move__location_id"."parent_left" < $652))))  AND  ((((((((((((("stock_move__location_dest_id"."parent_left" < $653)  OR  ("stock_move__location_dest_id"."parent_left" >= $654))  AND  (("stock_move__location_dest_id"."parent_left" < $655)  OR  ("stock_move__location_dest_id"."parent_left" >= $656)))  AND  (("stock_move__location_dest_id"."parent_left" < $657)  OR  ("stock_move__location_dest_id"."parent_left" >= $658)))  AND  (("stock_move__location_dest_id"."parent_left" < $659)  OR  ("stock_move__location_dest_id"."parent_left" >= $660)))  AND  (("stock_move__location_dest_id"."parent_left" < $661)  OR  ("stock_move__location_dest_id"."parent_left" >= $662)))  AND  (("stock_move__location_dest_id"."parent_left" < $663)  OR  ("stock_move__location_dest_id"."parent_left" >= $664)))  AND  (("stock_move__location_dest_id"."parent_left" < $665)  OR  ("stock_move__location_dest_id"."parent_left" >= $666)))  AND  (("stock_move__location_dest_id"."parent_left" < $667)  OR  ("stock_move__location_dest_id"."parent_left" >= $668)))  AND  (("stock_move__location_dest_id"."parent_left" < $669)  OR  ("stock_move__location_dest_id"."parent_left" >= $670)))  AND  (("stock_move__location_dest_id"."parent_left" < $671)  OR  ("stock_move__location_dest_id"."parent_left" >= $672)))  AND  (("stock_move__location_dest_id"."parent_left" < $673)  OR  ("stock_move__location_dest_id"."parent_left" >= $674)))  AND  (("stock_move__location_dest_id"."parent_left" < $675)  OR  ("stock_move__location_dest_id"."parent_left" >= $676))))
            GROUP BY "stock_move"."product_id"
            ORDER BY "id"
124 min < 0.1% 17,160 ms 433 odoo
SELECT min("stock_move".id) AS id, count("stock_move".id) AS "product_id_count" , sum("stock_move"."product_qty") AS "product_qty" ,"stock_move"."product_id" as "product_id" 
            FROM "stock_location" as "stock_move__location_dest_id","stock_location" as "stock_move__location_id","stock_move"
            WHERE ("stock_move"."location_dest_id"="stock_move__location_dest_id"."id" AND "stock_move"."location_id"="stock_move__location_id"."id") AND ((((("stock_move"."state" not in ($1,$2,$3)) OR "stock_move"."state" IS NULL)  AND  ("stock_move"."product_id" in ($4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$80,$81,$82,$83,$84,$85,$86,$87,$88,$89,$90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$100,$101,$102,$103,$104,$105,$106,$107,$108,$109,$110,$111,$112,$113,$114,$115,$116,$117,$118,$119,$120,$121,$122,$123,$124,$125,$126,$127,$128,$129,$130,$131,$132,$133,$134,$135,$136,$137,$138,$139,$140,$141,$142,$143,$144,$145,$146,$147,$148,$149,$150,$151,$152,$153,$154,$155,$156,$157,$158,$159,$160,$161,$162,$163,$164,$165,$166,$167,$168,$169,$170,$171,$172,$173,$174,$175,$176,$177,$178,$179,$180,$181,$182,$183,$184,$185,$186,$187,$188,$189,$190,$191,$192,$193,$194,$195,$196,$197,$198,$199,$200,$201,$202,$203,$204,$205,$206,$207,$208,$209,$210,$211,$212,$213,$214,$215,$216,$217,$218,$219,$220,$221,$222,$223,$224,$225,$226,$227,$228,$229,$230,$231,$232,$233,$234,$235,$236,$237,$238,$239,$240,$241,$242,$243,$244,$245,$246,$247,$248,$249,$250,$251,$252,$253,$254,$255,$256,$257,$258,$259,$260,$261,$262,$263,$264,$265,$266,$267,$268,$269,$270,$271,$272,$273,$274,$275,$276,$277,$278,$279,$280,$281,$282,$283,$284,$285,$286,$287,$288,$289,$290,$291,$292,$293,$294,$295,$296,$297,$298,$299,$300,$301,$302,$303,$304,$305,$306,$307,$308,$309,$310,$311,$312,$313,$314,$315,$316,$317,$318,$319,$320,$321,$322,$323,$324,$325,$326,$327,$328,$329,$330,$331,$332,$333,$334,$335,$336,$337,$338,$339,$340,$341,$342,$343,$344,$345,$346,$347,$348,$349,$350,$351,$352,$353,$354,$355,$356,$357,$358,$359,$360,$361,$362,$363,$364,$365,$366,$367,$368,$369,$370,$371,$372,$373,$374,$375,$376,$377,$378,$379,$380,$381,$382,$383,$384,$385,$386,$387,$388,$389,$390,$391,$392,$393,$394,$395,$396,$397,$398,$399,$400,$401,$402,$403,$404,$405,$406,$407,$408,$409,$410,$411,$412,$413,$414,$415,$416,$417,$418,$419,$420,$421,$422,$423,$424,$425,$426,$427,$428,$429,$430,$431,$432,$433,$434,$435,$436,$437,$438,$439,$440,$441,$442,$443,$444,$445,$446,$447,$448,$449,$450,$451,$452,$453,$454,$455,$456,$457,$458,$459,$460,$461,$462,$463,$464,$465,$466,$467,$468,$469,$470,$471,$472,$473,$474,$475,$476,$477,$478,$479,$480,$481,$482,$483,$484,$485,$486,$487,$488,$489,$490,$491,$492,$493,$494,$495,$496,$497,$498,$499,$500,$501,$502,$503,$504,$505,$506,$507,$508,$509,$510,$511,$512,$513,$514,$515,$516,$517,$518,$519,$520,$521,$522,$523,$524,$525,$526,$527,$528,$529,$530,$531,$532,$533,$534,$535,$536,$537,$538,$539,$540,$541,$542,$543,$544,$545,$546,$547,$548,$549,$550,$551,$552,$553,$554,$555,$556,$557,$558,$559,$560,$561,$562,$563,$564,$565,$566,$567,$568,$569,$570,$571,$572,$573,$574,$575,$576,$577,$578,$579,$580,$581,$582,$583,$584,$585,$586,$587,$588,$589,$590,$591,$592,$593,$594,$595,$596,$597,$598,$599,$600,$601,$602,$603,$604,$605,$606,$607,$608,$609,$610,$611,$612,$613,$614,$615,$616,$617,$618,$619,$620,$621,$622)))  AND  (((((("stock_move__location_dest_id"."parent_left" >= $623)  AND  ("stock_move__location_dest_id"."parent_left" < $624))  OR  (("stock_move__location_dest_id"."parent_left" >= $625)  AND  ("stock_move__location_dest_id"."parent_left" < $626)))  OR  (("stock_move__location_dest_id"."parent_left" >= $627)  AND  ("stock_move__location_dest_id"."parent_left" < $628)))  OR  (("stock_move__location_dest_id"."parent_left" >= $629)  AND  ("stock_move__location_dest_id"."parent_left" < $630)))  OR  ("stock_move"."location_dest_id" in ($631))))  AND  (((((("stock_move__location_id"."parent_left" < $632)  OR  ("stock_move__location_id"."parent_left" >= $633))  AND  (("stock_move__location_id"."parent_left" < $634)  OR  ("stock_move__location_id"."parent_left" >= $635)))  AND  (("stock_move__location_id"."parent_left" < $636)  OR  ("stock_move__location_id"."parent_left" >= $637)))  AND  (("stock_move__location_id"."parent_left" < $638)  OR  ("stock_move__location_id"."parent_left" >= $639)))  AND  (NOT (("stock_move"."location_id" in ($640))))))
            GROUP BY "stock_move"."product_id"
            ORDER BY "id"
120 min < 0.1% 16,405 ms 439 odoo
SELECT min("stock_move".id) AS id, count("stock_move".id) AS "product_id_count" , sum("stock_move"."product_qty") AS "product_qty" ,"stock_move"."product_id" as "product_id" 
            FROM "stock_location" as "stock_move__location_id","stock_location" as "stock_move__location_dest_id","stock_move"
            WHERE ("stock_move"."location_dest_id"="stock_move__location_dest_id"."id" AND "stock_move"."location_id"="stock_move__location_id"."id") AND ((((("stock_move"."state" not in ($1,$2,$3)) OR "stock_move"."state" IS NULL)  AND  ("stock_move"."product_id" in ($4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$80,$81,$82,$83,$84,$85,$86,$87,$88,$89,$90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$100,$101,$102,$103,$104,$105,$106,$107,$108,$109,$110,$111,$112,$113,$114,$115,$116,$117,$118,$119,$120,$121,$122,$123,$124,$125,$126,$127,$128,$129,$130,$131,$132,$133,$134,$135,$136,$137,$138,$139,$140,$141,$142,$143,$144,$145,$146,$147,$148,$149,$150,$151,$152,$153,$154,$155,$156,$157,$158,$159,$160,$161,$162,$163,$164,$165,$166,$167,$168,$169,$170,$171,$172,$173,$174,$175,$176,$177,$178,$179,$180,$181,$182,$183,$184,$185,$186,$187,$188,$189,$190,$191,$192,$193,$194,$195,$196,$197,$198,$199,$200,$201,$202,$203,$204,$205,$206,$207,$208,$209,$210,$211,$212,$213,$214,$215,$216,$217,$218,$219,$220,$221,$222,$223,$224,$225,$226,$227,$228,$229,$230,$231,$232,$233,$234,$235,$236,$237,$238,$239,$240,$241,$242,$243,$244,$245,$246,$247,$248,$249,$250,$251,$252,$253,$254,$255,$256,$257,$258,$259,$260,$261,$262,$263,$264,$265,$266,$267,$268,$269,$270,$271,$272,$273,$274,$275,$276,$277,$278,$279,$280,$281,$282,$283,$284,$285,$286,$287,$288,$289,$290,$291,$292,$293,$294,$295,$296,$297,$298,$299,$300,$301,$302,$303,$304,$305,$306,$307,$308,$309,$310,$311,$312,$313,$314,$315,$316,$317,$318,$319,$320,$321,$322,$323,$324,$325,$326,$327,$328,$329,$330,$331,$332,$333,$334,$335,$336,$337,$338,$339,$340,$341,$342,$343,$344,$345,$346,$347,$348,$349,$350,$351,$352,$353,$354,$355,$356,$357,$358,$359,$360,$361,$362,$363,$364,$365,$366,$367,$368,$369,$370,$371,$372,$373,$374,$375,$376,$377,$378,$379,$380,$381,$382,$383,$384,$385,$386,$387,$388,$389,$390,$391,$392,$393,$394,$395,$396,$397,$398,$399,$400,$401,$402,$403,$404,$405,$406,$407,$408,$409,$410,$411,$412,$413,$414,$415,$416,$417,$418,$419,$420,$421,$422,$423,$424,$425,$426,$427,$428,$429,$430,$431,$432,$433,$434,$435,$436,$437,$438,$439,$440,$441,$442,$443,$444,$445,$446,$447,$448,$449,$450,$451,$452,$453,$454,$455,$456,$457,$458,$459,$460,$461,$462,$463,$464,$465,$466,$467,$468,$469,$470,$471,$472,$473,$474,$475,$476,$477,$478,$479,$480,$481,$482,$483,$484,$485,$486,$487,$488,$489,$490,$491,$492,$493,$494,$495,$496,$497,$498,$499,$500,$501,$502,$503,$504,$505,$506,$507,$508,$509,$510,$511,$512,$513,$514,$515,$516,$517,$518,$519,$520,$521,$522,$523,$524,$525,$526,$527,$528,$529,$530,$531,$532,$533,$534,$535,$536,$537,$538,$539,$540,$541,$542,$543,$544,$545,$546,$547,$548,$549,$550,$551,$552,$553,$554,$555,$556,$557,$558,$559,$560,$561,$562,$563,$564,$565,$566,$567,$568,$569,$570,$571,$572,$573,$574,$575,$576,$577,$578,$579,$580,$581,$582,$583,$584,$585,$586,$587,$588,$589,$590,$591,$592,$593,$594,$595,$596,$597,$598,$599,$600,$601,$602,$603,$604,$605,$606,$607,$608,$609,$610,$611,$612,$613,$614,$615,$616,$617,$618,$619,$620,$621,$622)))  AND  ((((((((((((("stock_move__location_id"."parent_left" >= $623)  AND  ("stock_move__location_id"."parent_left" < $624))  OR  (("stock_move__location_id"."parent_left" >= $625)  AND  ("stock_move__location_id"."parent_left" < $626)))  OR  (("stock_move__location_id"."parent_left" >= $627)  AND  ("stock_move__location_id"."parent_left" < $628)))  OR  (("stock_move__location_id"."parent_left" >= $629)  AND  ("stock_move__location_id"."parent_left" < $630)))  OR  (("stock_move__location_id"."parent_left" >= $631)  AND  ("stock_move__location_id"."parent_left" < $632)))  OR  (("stock_move__location_id"."parent_left" >= $633)  AND  ("stock_move__location_id"."parent_left" < $634)))  OR  (("stock_move__location_id"."parent_left" >= $635)  AND  ("stock_move__location_id"."parent_left" < $636)))  OR  (("stock_move__location_id"."parent_left" >= $637)  AND  ("stock_move__location_id"."parent_left" < $638)))  OR  (("stock_move__location_id"."parent_left" >= $639)  AND  ("stock_move__location_id"."parent_left" < $640)))  OR  (("stock_move__location_id"."parent_left" >= $641)  AND  ("stock_move__location_id"."parent_left" < $642)))  OR  (("stock_move__location_id"."parent_left" >= $643)  AND  ("stock_move__location_id"."parent_left" < $644)))  OR  (("stock_move__location_id"."parent_left" >= $645)  AND  ("stock_move__location_id"."parent_left" < $646))))  AND  ((((((((((((("stock_move__location_dest_id"."parent_left" < $647)  OR  ("stock_move__location_dest_id"."parent_left" >= $648))  AND  (("stock_move__location_dest_id"."parent_left" < $649)  OR  ("stock_move__location_dest_id"."parent_left" >= $650)))  AND  (("stock_move__location_dest_id"."parent_left" < $651)  OR  ("stock_move__location_dest_id"."parent_left" >= $652)))  AND  (("stock_move__location_dest_id"."parent_left" < $653)  OR  ("stock_move__location_dest_id"."parent_left" >= $654)))  AND  (("stock_move__location_dest_id"."parent_left" < $655)  OR  ("stock_move__location_dest_id"."parent_left" >= $656)))  AND  (("stock_move__location_dest_id"."parent_left" < $657)  OR  ("stock_move__location_dest_id"."parent_left" >= $658)))  AND  (("stock_move__location_dest_id"."parent_left" < $659)  OR  ("stock_move__location_dest_id"."parent_left" >= $660)))  AND  (("stock_move__location_dest_id"."parent_left" < $661)  OR  ("stock_move__location_dest_id"."parent_left" >= $662)))  AND  (("stock_move__location_dest_id"."parent_left" < $663)  OR  ("stock_move__location_dest_id"."parent_left" >= $664)))  AND  (("stock_move__location_dest_id"."parent_left" < $665)  OR  ("stock_move__location_dest_id"."parent_left" >= $666)))  AND  (("stock_move__location_dest_id"."parent_left" < $667)  OR  ("stock_move__location_dest_id"."parent_left" >= $668)))  AND  (("stock_move__location_dest_id"."parent_left" < $669)  OR  ("stock_move__location_dest_id"."parent_left" >= $670))))
            GROUP BY "stock_move"."product_id"
            ORDER BY "id"
118 min < 0.1% 16,798 ms 421 odoo
SELECT min("stock_move".id) AS id, count("stock_move".id) AS "product_id_count" , sum("stock_move"."product_qty") AS "product_qty" ,"stock_move"."product_id" as "product_id" 
            FROM "stock_location" as "stock_move__location_id","stock_location" as "stock_move__location_dest_id","stock_move"
            WHERE ("stock_move"."location_dest_id"="stock_move__location_dest_id"."id" AND "stock_move"."location_id"="stock_move__location_id"."id") AND ((((("stock_move"."state" not in ($1,$2,$3)) OR "stock_move"."state" IS NULL)  AND  ("stock_move"."product_id" in ($4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$80,$81,$82,$83,$84,$85,$86,$87,$88,$89,$90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$100,$101,$102,$103,$104,$105,$106,$107,$108,$109,$110,$111,$112,$113,$114,$115,$116,$117,$118,$119,$120,$121,$122,$123,$124,$125,$126,$127,$128,$129,$130,$131,$132,$133,$134,$135,$136,$137,$138,$139,$140,$141,$142,$143,$144,$145,$146,$147,$148,$149,$150,$151,$152,$153,$154,$155,$156,$157,$158,$159,$160,$161,$162,$163,$164,$165,$166,$167,$168,$169,$170,$171,$172,$173,$174,$175,$176,$177,$178,$179,$180,$181,$182,$183,$184,$185,$186,$187,$188,$189,$190,$191,$192,$193,$194,$195,$196,$197,$198,$199,$200,$201,$202,$203,$204,$205,$206,$207,$208,$209,$210,$211,$212,$213,$214,$215,$216,$217,$218,$219,$220,$221,$222,$223,$224,$225,$226,$227,$228,$229,$230,$231,$232,$233,$234,$235,$236,$237,$238,$239,$240,$241,$242,$243,$244,$245,$246,$247,$248,$249,$250,$251,$252,$253,$254,$255,$256,$257,$258,$259,$260,$261,$262,$263,$264,$265,$266,$267,$268,$269,$270,$271,$272,$273,$274,$275,$276,$277,$278,$279,$280,$281,$282,$283,$284,$285,$286,$287,$288,$289,$290,$291,$292,$293,$294,$295,$296,$297,$298,$299,$300,$301,$302,$303,$304,$305,$306,$307,$308,$309,$310,$311,$312,$313,$314,$315,$316,$317,$318,$319,$320,$321,$322,$323,$324,$325,$326,$327,$328,$329,$330,$331,$332,$333,$334,$335,$336,$337,$338,$339,$340,$341,$342,$343,$344,$345,$346,$347,$348,$349,$350,$351,$352,$353,$354,$355,$356,$357,$358,$359,$360,$361,$362,$363,$364,$365,$366,$367,$368,$369,$370,$371,$372,$373,$374,$375,$376,$377,$378,$379,$380,$381,$382,$383,$384,$385,$386,$387,$388,$389,$390,$391,$392,$393,$394,$395,$396,$397,$398,$399,$400,$401,$402,$403,$404,$405,$406,$407,$408,$409,$410,$411,$412,$413,$414,$415,$416,$417,$418,$419,$420,$421,$422,$423,$424,$425,$426,$427,$428,$429,$430,$431,$432,$433,$434,$435,$436,$437,$438,$439,$440,$441,$442,$443,$444,$445,$446,$447,$448,$449,$450,$451,$452,$453,$454,$455,$456,$457,$458,$459,$460,$461,$462,$463,$464,$465,$466,$467,$468,$469,$470,$471,$472,$473,$474,$475,$476,$477,$478,$479,$480,$481,$482,$483,$484,$485,$486,$487,$488,$489,$490,$491,$492,$493,$494,$495,$496,$497,$498,$499,$500,$501,$502,$503,$504,$505,$506,$507,$508,$509,$510,$511,$512,$513,$514,$515,$516,$517,$518,$519,$520,$521,$522,$523,$524,$525,$526,$527,$528,$529,$530,$531,$532,$533,$534,$535,$536,$537,$538,$539,$540,$541,$542,$543,$544,$545,$546,$547,$548,$549,$550,$551,$552,$553,$554,$555,$556,$557,$558,$559,$560,$561,$562,$563,$564,$565,$566,$567,$568,$569,$570,$571,$572,$573,$574,$575,$576,$577,$578,$579,$580,$581,$582,$583,$584,$585,$586,$587,$588,$589,$590,$591,$592,$593,$594,$595,$596,$597,$598,$599,$600,$601,$602,$603,$604,$605,$606,$607,$608,$609,$610,$611,$612,$613,$614,$615,$616,$617,$618,$619,$620,$621,$622)))  AND  (((((("stock_move__location_id"."parent_left" >= $623)  AND  ("stock_move__location_id"."parent_left" < $624))  OR  (("stock_move__location_id"."parent_left" >= $625)  AND  ("stock_move__location_id"."parent_left" < $626)))  OR  (("stock_move__location_id"."parent_left" >= $627)  AND  ("stock_move__location_id"."parent_left" < $628)))  OR  (("stock_move__location_id"."parent_left" >= $629)  AND  ("stock_move__location_id"."parent_left" < $630)))  OR  ("stock_move"."location_id" in ($631))))  AND  (((((("stock_move__location_dest_id"."parent_left" < $632)  OR  ("stock_move__location_dest_id"."parent_left" >= $633))  AND  (("stock_move__location_dest_id"."parent_left" < $634)  OR  ("stock_move__location_dest_id"."parent_left" >= $635)))  AND  (("stock_move__location_dest_id"."parent_left" < $636)  OR  ("stock_move__location_dest_id"."parent_left" >= $637)))  AND  (("stock_move__location_dest_id"."parent_left" < $638)  OR  ("stock_move__location_dest_id"."parent_left" >= $639)))  AND  (NOT (("stock_move"."location_dest_id" in ($640))))))
            GROUP BY "stock_move"."product_id"
            ORDER BY "id"
110 min < 0.1% 960 ms 6,846 odoo
SELECT min("stock_picking".id) AS id, count("stock_picking".id) AS "picking_type_id_count" , "stock_picking"."picking_type_id" as "picking_type_id" 
            FROM "stock_picking" LEFT JOIN "stock_picking_type" as "stock_picking__picking_type_id" ON ("stock_picking"."picking_type_id" = "stock_picking__picking_type_id"."id")
            WHERE ((("stock_picking"."state" = $1)  AND  (("stock_picking"."state" not in ($2,$3)) OR "stock_picking"."state" IS NULL))  AND  ("stock_picking"."picking_type_id" in ($4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38))) AND ("stock_picking"."company_id" IS NULL   OR  ("stock_picking"."company_id" in ($39)))
            GROUP BY "stock_picking"."picking_type_id","stock_picking__picking_type_id"."sequence","stock_picking__picking_type_id"."id"
            ORDER BY  "stock_picking__picking_type_id"."sequence" ,"stock_picking__picking_type_id"."id"
87 min < 0.1% 253 ms 20,562 odoo
SELECT "stock_inventory_line".id FROM "stock_inventory_line" WHERE ("stock_inventory_line"."prod_lot_id" in ($1)) ORDER BY "stock_inventory_line"."id"
Details
CREATE INDEX CONCURRENTLY ON stock_inventory_line (prod_lot_id)
Rows: 95423
Row progression: 95423, 2

Row estimates
- prod_lot_id (=): 2
- id (sort): 1

Existing indexes
- id PRIMARY
- company_id
- inventory_id
- location_id
- package_id
- product_id
67 min < 0.1% 86 ms 46,853 odoo
SELECT "purchase_order_line".id FROM "purchase_order_line" LEFT JOIN "purchase_order" as "purchase_order_line__order_id" ON ("purchase_order_line"."order_id" = "purchase_order_line__order_id"."id") WHERE (("purchase_order_line"."state" in ($1,$2))  AND  ("purchase_order_line"."product_id" in ($3))) AND ("purchase_order_line"."company_id" IS NULL   OR  ("purchase_order_line"."company_id" in ($4))) ORDER BY "purchase_order_line__order_id"."date_order" DESC,"purchase_order_line__order_id"."id" DESC,"purchase_order_line"."sequence" ,"purchase_order_line"."id"
60 min < 0.1% 36,276 ms 100 odoo
SELECT min("stock_move".id) AS id, count("stock_move".id) AS "product_id_count" , sum("stock_move"."product_qty") AS "product_qty" ,"stock_move"."product_id" as "product_id" 
            FROM "stock_location" as "stock_move__location_id","stock_location" as "stock_move__location_dest_id","stock_move"
            WHERE ("stock_move"."location_dest_id"="stock_move__location_dest_id"."id" AND "stock_move"."location_id"="stock_move__location_id"."id") AND ((((("stock_move"."state" not in ($1,$2,$3)) OR "stock_move"."state" IS NULL)  AND  ("stock_move"."product_id" in ($4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$80,$81,$82,$83,$84,$85,$86,$87,$88,$89,$90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$100,$101,$102,$103,$104,$105,$106,$107,$108,$109,$110,$111,$112,$113,$114,$115,$116,$117,$118,$119,$120,$121,$122,$123,$124,$125,$126,$127,$128,$129,$130,$131,$132,$133,$134,$135,$136,$137,$138,$139,$140,$141,$142,$143,$144,$145,$146,$147,$148,$149,$150,$151,$152,$153,$154,$155,$156,$157,$158,$159,$160,$161,$162,$163,$164,$165,$166,$167,$168,$169,$170,$171,$172,$173,$174,$175,$176,$177,$178,$179,$180,$181,$182,$183,$184,$185,$186,$187,$188,$189,$190,$191,$192,$193,$194,$195,$196,$197,$198,$199,$200,$201,$202,$203,$204,$205,$206,$207,$208,$209,$210,$211,$212,$213,$214,$215,$216,$217,$218,$219,$220,$221,$222,$223,$224,$225,$226,$227,$228,$229,$230,$231,$232,$233,$234,$235,$236,$237,$238,$239,$240,$241,$242,$243,$244,$245,$246,$247,$248,$249,$250,$251,$252,$253,$254,$255,$256,$257,$258,$259,$260,$261,$262,$263,$264,$265,$266,$267,$268,$269,$270,$271,$272,$273,$274,$275,$276,$277,$278,$279,$280,$281,$282,$283,$284,$285,$286,$287,$288,$289,$290,$291,$292,$293,$294,$295,$296,$297,$298,$299,$300,$301,$302,$303,$304,$305,$306,$307,$308,$309,$310,$311,$312,$313,$314,$315,$316,$317,$318,$319,$320,$321,$322,$323,$324,$325,$326,$327,$328,$329,$330,$331,$332,$333,$334,$335,$336,$337,$338,$339,$340,$341,$342,$343,$344,$345,$346,$347,$348,$349,$350,$351,$352,$353,$354,$355,$356,$357,$358,$359,$360,$361,$362,$363,$364,$365,$366,$367,$368,$369,$370,$371,$372,$373,$374,$375,$376,$377,$378,$379,$380,$381,$382,$383,$384,$385,$386,$387,$388,$389,$390,$391,$392,$393,$394,$395,$396,$397,$398,$399,$400,$401,$402,$403,$404,$405,$406,$407,$408,$409,$410,$411,$412,$413,$414,$415,$416,$417,$418,$419,$420,$421,$422,$423,$424,$425,$426,$427,$428,$429,$430,$431,$432,$433,$434,$435,$436,$437,$438,$439,$440,$441,$442,$443,$444,$445,$446,$447,$448,$449,$450,$451,$452,$453,$454,$455,$456,$457,$458,$459,$460,$461,$462,$463,$464,$465,$466,$467,$468,$469,$470,$471,$472,$473,$474,$475,$476,$477,$478,$479,$480,$481,$482,$483,$484,$485,$486,$487,$488,$489,$490,$491,$492,$493,$494,$495,$496,$497,$498,$499,$500,$501,$502,$503,$504,$505,$506,$507,$508,$509,$510,$511,$512,$513,$514,$515,$516,$517,$518,$519,$520,$521,$522,$523,$524,$525,$526,$527,$528,$529,$530,$531,$532,$533,$534,$535,$536,$537,$538,$539,$540,$541,$542,$543,$544,$545,$546,$547,$548,$549,$550,$551,$552,$553,$554,$555,$556,$557,$558,$559,$560,$561,$562,$563,$564,$565,$566,$567,$568,$569,$570,$571,$572,$573,$574,$575,$576,$577,$578,$579,$580,$581,$582,$583,$584,$585,$586,$587,$588,$589,$590,$591,$592,$593,$594,$595,$596,$597,$598,$599,$600,$601,$602,$603,$604,$605,$606,$607,$608,$609,$610,$611,$612,$613,$614,$615,$616,$617,$618,$619,$620,$621,$622,$623,$624,$625,$626,$627,$628,$629,$630,$631,$632,$633,$634,$635,$636,$637,$638,$639,$640,$641,$642,$643,$644,$645,$646,$647,$648,$649,$650,$651,$652,$653,$654,$655,$656,$657,$658,$659,$660,$661,$662,$663,$664,$665,$666,$667,$668,$669,$670,$671,$672,$673,$674,$675,$676,$677,$678,$679,$680,$681,$682,$683,$684,$685,$686,$687,$688,$689,$690,$691,$692,$693,$694,$695,$696,$697,$698,$699,$700,$701,$702,$703,$704,$705,$706,$707,$708,$709,$710,$711,$712,$713,$714,$715,$716,$717,$718,$719,$720,$721,$722,$723,$724,$725,$726,$727,$728,$729,$730,$731,$732,$733,$734,$735,$736,$737,$738,$739,$740,$741,$742,$743,$744,$745,$746,$747,$748,$749,$750,$751,$752,$753,$754,$755,$756,$757,$758,$759,$760,$761,$762,$763,$764,$765,$766,$767,$768,$769,$770,$771,$772,$773,$774,$775,$776,$777,$778,$779,$780,$781,$782,$783,$784,$785,$786,$787,$788,$789,$790,$791,$792,$793,$794,$795,$796,$797,$798,$799,$800,$801,$802,$803,$804,$805,$806,$807,$808,$809,$810,$811,$812,$813,$814,$815,$816,$817,$818,$819,$820,$821,$822,$823,$824,$825,$826,$827,$828,$829,$830,$831,$832,$833,$834,$835,$836,$837,$838,$839,$840,$841,$842,$843,$844,$845,$846,$847,$848,$849,$850,$851,$852,$853,$854,$855,$856,$857,$858,$859,$860,$861,$862,$863,$864,$865,$866)))  AND  ((((((((((((("stock_move__location_id"."parent_left" >= $867)  AND  ("stock_move__location_id"."parent_left" < $868))  OR  (("stock_move__location_id"."parent_left" >= $869)  AND  ("stock_move__location_id"."parent_left" < $870)))  OR  (("stock_move__location_id"."parent_left" >= $871)  AND  ("stock_move__location_id"."parent_left" < $872)))  OR  (("stock_move__location_id"."parent_left" >= $873)  AND  ("stock_move__location_id"."parent_left" < $874)))  OR  (("stock_move__location_id"."parent_left" >= $875)  AND  ("stock_move__location_id"."parent_left" < $876)))  OR  (("stock_move__location_id"."parent_left" >= $877)  AND  ("stock_move__location_id"."parent_left" < $878)))  OR  (("stock_move__location_id"."parent_left" >= $879)  AND  ("stock_move__location_id"."parent_left" < $880)))  OR  (("stock_move__location_id"."parent_left" >= $881)  AND  ("stock_move__location_id"."parent_left" < $882)))  OR  (("stock_move__location_id"."parent_left" >= $883)  AND  ("stock_move__location_id"."parent_left" < $884)))  OR  (("stock_move__location_id"."parent_left" >= $885)  AND  ("stock_move__location_id"."parent_left" < $886)))  OR  (("stock_move__location_id"."parent_left" >= $887)  AND  ("stock_move__location_id"."parent_left" < $888)))  OR  (("stock_move__location_id"."parent_left" >= $889)  AND  ("stock_move__location_id"."parent_left" < $890))))  AND  ((((((((((((("stock_move__location_dest_id"."parent_left" < $891)  OR  ("stock_move__location_dest_id"."parent_left" >= $892))  AND  (("stock_move__location_dest_id"."parent_left" < $893)  OR  ("stock_move__location_dest_id"."parent_left" >= $894)))  AND  (("stock_move__location_dest_id"."parent_left" < $895)  OR  ("stock_move__location_dest_id"."parent_left" >= $896)))  AND  (("stock_move__location_dest_id"."parent_left" < $897)  OR  ("stock_move__location_dest_id"."parent_left" >= $898)))  AND  (("stock_move__location_dest_id"."parent_left" < $899)  OR  ("stock_move__location_dest_id"."parent_left" >= $900)))  AND  (("stock_move__location_dest_id"."parent_left" < $901)  OR  ("stock_move__location_dest_id"."parent_left" >= $902)))  AND  (("stock_move__location_dest_id"."parent_left" < $903)  OR  ("stock_move__location_dest_id"."parent_left" >= $904)))  AND  (("stock_move__location_dest_id"."parent_left" < $905)  OR  ("stock_move__location_dest_id"."parent_left" >= $906)))  AND  (("stock_move__location_dest_id"."parent_left" < $907)  OR  ("stock_move__location_dest_id"."parent_left" >= $908)))  AND  (("stock_move__location_dest_id"."parent_left" < $909)  OR  ("stock_move__location_dest_id"."parent_left" >= $910)))  AND  (("stock_move__location_dest_id"."parent_left" < $911)  OR  ("stock_move__location_dest_id"."parent_left" >= $912)))  AND  (("stock_move__location_dest_id"."parent_left" < $913)  OR  ("stock_move__location_dest_id"."parent_left" >= $914))))
            GROUP BY "stock_move"."product_id"
            ORDER BY "id"
58 min < 0.1% 1,014 ms 3,423 odoo
SELECT min("stock_picking".id) AS id, count("stock_picking".id) AS "picking_type_id_count" , "stock_picking"."picking_type_id" as "picking_type_id" 
            FROM "stock_picking" LEFT JOIN "stock_picking_type" as "stock_picking__picking_type_id" ON ("stock_picking"."picking_type_id" = "stock_picking__picking_type_id"."id")
            WHERE (((("stock_picking"."scheduled_date" < $1)  AND  ("stock_picking"."state" in ($2,$3,$4)))  AND  (("stock_picking"."state" not in ($5,$6)) OR "stock_picking"."state" IS NULL))  AND  ("stock_picking"."picking_type_id" in ($7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41))) AND ("stock_picking"."company_id" IS NULL   OR  ("stock_picking"."company_id" in ($42)))
            GROUP BY "stock_picking"."picking_type_id","stock_picking__picking_type_id"."sequence","stock_picking__picking_type_id"."id"
            ORDER BY  "stock_picking__picking_type_id"."sequence" ,"stock_picking__picking_type_id"."id"
54 min < 0.1% 22 ms 145,040 odoo
SELECT "order_dispatch".id FROM "order_dispatch" WHERE ("order_dispatch"."state" = $1) ORDER BY "order_dispatch"."create_date" DESC  limit $2
Details
CREATE INDEX CONCURRENTLY ON order_dispatch (state, create_date)
Rows: 34502
Row progression: 34502, 11500, 0

Row estimates
- state (=): 11500
- create_date (sort): 1

Existing indexes
- id PRIMARY
53 min < 0.1% 12,885 ms 249 odoo
SELECT "stock_move".id FROM "stock_move" LEFT JOIN "stock_picking" as "stock_move__picking_id" ON ("stock_move"."picking_id" = "stock_move__picking_id"."id") WHERE ("stock_move"."sale_line_id" in ($1,$2,$3,$4,$5,$6)) ORDER BY "stock_move__picking_id"."priority" DESC,"stock_move__picking_id"."date" ASC,"stock_move__picking_id"."id" DESC,"stock_move"."sequence" ,"stock_move"."id"
46 min < 0.1% 155 ms 17,895 odoo
SELECT "product_template".id FROM "product_template" LEFT JOIN 
                (SELECT DISTINCT ON (res_id) res_id, value
                 FROM "ir_translation"
                 WHERE name=$1 AND lang=$2 AND value!=$3
                 ORDER BY res_id, id DESC)
             as "product_template__name" ON ("product_template"."id" = "product_template__name"."res_id") WHERE ((("product_template"."active" = $4)  AND  ("product_template"."type" in ($5,$6)))  AND  (("product_template"."id" in (WITH temp_irt_current (id, name) as (
                            SELECT ct.id, coalesce(it.value,ct."name")
                            FROM product_template ct
                            LEFT JOIN ir_translation it ON (it.name = $7 and
                                        it.lang = $8 and
                                        it.type = $9 and
                                        it.res_id = ct.id and
                                        it.value != $10)
                            )
                            SELECT id FROM temp_irt_current WHERE name ilike $11 order by name
                            ))  OR  $12)) ORDER BY COALESCE("product_template__name"."value", "product_template"."name")   limit $13
45 min < 0.1% 790 ms 3,423 odoo
SELECT min("stock_picking".id) AS id, count("stock_picking".id) AS "picking_type_id_count" , "stock_picking"."picking_type_id" as "picking_type_id" 
            FROM "stock_picking" LEFT JOIN "stock_picking_type" as "stock_picking__picking_type_id" ON ("stock_picking"."picking_type_id" = "stock_picking__picking_type_id"."id")
            WHERE ((("stock_picking"."state" in ($1,$2,$3))  AND  (("stock_picking"."state" not in ($4,$5)) OR "stock_picking"."state" IS NULL))  AND  ("stock_picking"."picking_type_id" in ($6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40))) AND ("stock_picking"."company_id" IS NULL   OR  ("stock_picking"."company_id" in ($41)))
            GROUP BY "stock_picking"."picking_type_id","stock_picking__picking_type_id"."sequence","stock_picking__picking_type_id"."id"
            ORDER BY  "stock_picking__picking_type_id"."sequence" ,"stock_picking__picking_type_id"."id"
45 min < 0.1% 12,279 ms 220 odoo
SELECT min("stock_move".id) AS id, count("stock_move".id) AS "product_id_count" , sum("stock_move"."product_qty") AS "product_qty" ,"stock_move"."product_id" as "product_id" 
            FROM "stock_location" as "stock_move__location_id","stock_location" as "stock_move__location_dest_id","stock_move"
            WHERE ("stock_move"."location_id"="stock_move__location_id"."id" AND "stock_move"."location_dest_id"="stock_move__location_dest_id"."id") AND (((((("stock_move"."state" not in ($1,$2,$3)) OR "stock_move"."state" IS NULL)  AND  ("stock_move"."product_id" in ($4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$80,$81,$82,$83,$84,$85,$86,$87,$88,$89,$90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$100,$101,$102,$103,$104,$105,$106,$107,$108,$109,$110,$111,$112,$113,$114,$115,$116,$117,$118,$119,$120,$121,$122,$123,$124,$125,$126,$127,$128,$129,$130,$131,$132,$133,$134,$135,$136,$137,$138,$139,$140,$141,$142,$143,$144,$145,$146,$147,$148,$149,$150,$151,$152,$153,$154,$155,$156,$157,$158,$159,$160,$161,$162,$163,$164,$165,$166,$167,$168,$169,$170,$171,$172,$173,$174,$175,$176,$177,$178,$179,$180,$181,$182,$183,$184,$185,$186,$187,$188,$189,$190,$191,$192,$193,$194,$195,$196,$197,$198,$199,$200,$201,$202,$203,$204,$205,$206,$207,$208,$209,$210,$211,$212,$213,$214,$215,$216,$217,$218,$219,$220,$221,$222,$223,$224,$225,$226,$227,$228,$229,$230,$231,$232,$233,$234,$235,$236,$237,$238,$239,$240,$241,$242,$243,$244,$245,$246,$247,$248,$249,$250,$251,$252,$253,$254,$255,$256,$257,$258,$259,$260,$261,$262,$263,$264,$265,$266,$267,$268,$269,$270,$271,$272,$273,$274,$275,$276,$277,$278,$279,$280,$281,$282,$283,$284,$285,$286,$287,$288,$289,$290,$291,$292,$293,$294,$295,$296,$297,$298,$299,$300,$301,$302,$303,$304,$305,$306,$307,$308,$309,$310,$311,$312,$313,$314,$315,$316,$317,$318,$319,$320,$321,$322,$323,$324,$325,$326,$327,$328,$329,$330,$331,$332,$333,$334,$335,$336,$337,$338,$339,$340,$341,$342,$343,$344,$345,$346,$347,$348,$349,$350,$351,$352,$353,$354,$355,$356,$357,$358,$359,$360,$361,$362,$363,$364,$365,$366,$367,$368,$369,$370,$371,$372,$373,$374,$375,$376,$377,$378,$379,$380,$381,$382,$383,$384,$385,$386,$387,$388,$389,$390,$391,$392,$393,$394,$395,$396,$397,$398,$399,$400,$401,$402,$403,$404,$405,$406,$407,$408,$409,$410,$411,$412,$413,$414,$415,$416,$417,$418,$419,$420,$421,$422,$423,$424,$425,$426,$427,$428,$429,$430,$431,$432,$433,$434,$435,$436,$437,$438,$439,$440,$441,$442,$443,$444,$445,$446,$447,$448,$449,$450,$451,$452,$453,$454,$455,$456,$457,$458,$459,$460,$461,$462,$463,$464,$465,$466,$467,$468,$469,$470,$471,$472,$473,$474,$475,$476,$477,$478,$479,$480,$481,$482,$483,$484,$485,$486,$487,$488,$489,$490,$491,$492,$493,$494,$495,$496,$497,$498,$499,$500,$501,$502,$503,$504,$505,$506,$507,$508,$509,$510,$511,$512,$513,$514,$515,$516,$517,$518,$519,$520,$521,$522,$523,$524,$525,$526,$527,$528,$529,$530,$531,$532,$533,$534,$535,$536,$537,$538,$539,$540,$541,$542,$543,$544,$545,$546,$547,$548,$549,$550,$551,$552,$553,$554,$555,$556,$557,$558,$559,$560,$561,$562,$563,$564,$565,$566,$567,$568,$569,$570,$571,$572,$573,$574,$575,$576,$577,$578,$579,$580,$581,$582,$583,$584,$585,$586,$587,$588,$589,$590,$591,$592,$593,$594,$595,$596,$597,$598,$599,$600,$601,$602,$603,$604,$605,$606,$607,$608,$609,$610,$611,$612,$613,$614,$615,$616,$617,$618,$619,$620,$621,$622,$623,$624,$625,$626,$627,$628,$629,$630,$631,$632,$633,$634,$635,$636,$637,$638,$639,$640,$641,$642,$643,$644,$645,$646,$647,$648,$649,$650,$651,$652,$653,$654,$655,$656,$657,$658,$659,$660,$661,$662,$663,$664,$665,$666,$667,$668,$669,$670,$671,$672,$673,$674,$675,$676,$677,$678,$679,$680,$681,$682,$683,$684,$685,$686,$687,$688,$689,$690,$691,$692,$693,$694,$695,$696,$697,$698,$699,$700,$701,$702,$703,$704,$705,$706,$707,$708,$709,$710,$711,$712,$713,$714,$715,$716,$717,$718,$719,$720,$721,$722,$723,$724,$725,$726,$727,$728,$729,$730,$731,$732,$733,$734,$735,$736,$737,$738,$739,$740,$741,$742,$743,$744,$745,$746,$747,$748,$749,$750,$751,$752,$753,$754,$755,$756,$757,$758,$759,$760,$761,$762,$763,$764,$765,$766,$767,$768,$769,$770,$771,$772,$773,$774,$775,$776,$777,$778,$779,$780,$781,$782,$783,$784,$785,$786,$787,$788,$789,$790,$791,$792,$793,$794,$795,$796,$797,$798,$799,$800,$801,$802,$803,$804,$805,$806,$807,$808,$809,$810,$811,$812,$813,$814,$815,$816,$817,$818,$819,$820,$821,$822,$823,$824,$825,$826,$827,$828,$829,$830,$831,$832,$833,$834,$835,$836,$837,$838,$839,$840,$841,$842,$843,$844,$845,$846,$847,$848,$849,$850,$851,$852,$853,$854,$855,$856,$857,$858,$859,$860,$861,$862,$863,$864,$865,$866,$867,$868,$869,$870,$871,$872,$873,$874,$875,$876,$877,$878,$879,$880,$881,$882,$883,$884,$885,$886,$887,$888,$889,$890,$891,$892,$893,$894,$895,$896,$897,$898,$899,$900,$901,$902,$903,$904,$905,$906,$907,$908,$909,$910,$911,$912,$913,$914,$915,$916,$917,$918,$919,$920,$921,$922,$923,$924,$925,$926,$927,$928,$929,$930,$931,$932,$933,$934,$935,$936,$937,$938,$939,$940,$941,$942,$943,$944,$945,$946,$947,$948,$949,$950,$951,$952,$953,$954,$955,$956,$957,$958,$959,$960,$961,$962,$963,$964,$965,$966,$967,$968,$969,$970,$971,$972,$973,$974,$975,$976,$977,$978,$979,$980,$981,$982,$983,$984,$985,$986,$987,$988,$989,$990,$991,$992,$993,$994,$995,$996,$997,$998,$999,$1000,$1001,$1002,$1003,$1004,$1005,$1006,$1007,$1008,$1009,$1010,$1011,$1012,$1013,$1014,$1015,$1016,$1017,$1018,$1019,$1020,$1021,$1022,$1023,$1024,$1025,$1026,$1027,$1028,$1029,$1030,$1031,$1032,$1033,$1034,$1035,$1036,$1037,$1038,$1039,$1040,$1041,$1042,$1043,$1044,$1045,$1046,$1047,$1048,$1049,$1050,$1051,$1052,$1053,$1054,$1055,$1056,$1057,$1058,$1059,$1060,$1061,$1062,$1063,$1064,$1065,$1066,$1067,$1068,$1069,$1070,$1071,$1072,$1073,$1074,$1075,$1076,$1077,$1078,$1079,$1080,$1081,$1082,$1083,$1084,$1085,$1086,$1087,$1088,$1089,$1090,$1091,$1092,$1093,$1094,$1095,$1096,$1097,$1098,$1099,$1100,$1101,$1102,$1103,$1104,$1105,$1106,$1107,$1108,$1109,$1110,$1111,$1112,$1113,$1114,$1115,$1116,$1117,$1118,$1119,$1120,$1121,$1122,$1123,$1124,$1125,$1126,$1127,$1128,$1129,$1130,$1131,$1132,$1133,$1134,$1135,$1136,$1137,$1138,$1139,$1140,$1141,$1142,$1143,$1144,$1145,$1146,$1147,$1148,$1149,$1150,$1151,$1152,$1153,$1154,$1155,$1156,$1157,$1158,$1159,$1160,$1161,$1162,$1163,$1164,$1165,$1166,$1167,$1168,$1169,$1170,$1171,$1172,$1173,$1174,$1175,$1176,$1177,$1178,$1179,$1180,$1181,$1182,$1183,$1184,$1185,$1186,$1187,$1188,$1189,$1190,$1191,$1192,$1193,$1194,$1195,$1196,$1197,$1198,$1199,$1200,$1201,$1202,$1203,$1204,$1205,$1206,$1207,$1208,$1209,$1210,$1211,$1212,$1213,$1214,$1215,$1216,$1217,$1218,$1219,$1220,$1221,$1222,$1223,$1224,$1225,$1226,$1227,$1228,$1229,$1230,$1231,$1232,$1233,$1234,$1235,$1236,$1237,$1238,$1239,$1240,$1241,$1242,$1243,$1244,$1245,$1246,$1247,$1248,$1249,$1250,$1251,$1252,$1253,$1254,$1255,$1256,$1257,$1258,$1259,$1260,$1261,$1262,$1263,$1264,$1265,$1266,$1267,$1268,$1269,$1270,$1271,$1272,$1273,$1274,$1275,$1276,$1277,$1278,$1279,$1280,$1281,$1282,$1283,$1284,$1285,$1286,$1287,$1288,$1289,$1290,$1291,$1292,$1293,$1294,$1295,$1296,$1297,$1298,$1299,$1300,$1301,$1302,$1303,$1304,$1305,$1306,$1307,$1308,$1309,$1310,$1311,$1312,$1313,$1314,$1315,$1316,$1317,$1318,$1319,$1320,$1321,$1322,$1323,$1324,$1325,$1326,$1327,$1328,$1329,$1330,$1331,$1332,$1333,$1334,$1335,$1336,$1337,$1338,$1339,$1340,$1341,$1342,$1343,$1344,$1345,$1346,$1347,$1348,$1349,$1350,$1351,$1352,$1353,$1354,$1355,$1356,$1357,$1358,$1359,$1360,$1361,$1362,$1363,$1364,$1365,$1366,$1367,$1368,$1369,$1370,$1371,$1372,$1373,$1374,$1375,$1376,$1377,$1378,$1379,$1380,$1381,$1382,$1383,$1384,$1385,$1386,$1387,$1388,$1389,$1390,$1391,$1392,$1393,$1394,$1395,$1396,$1397,$1398,$1399,$1400,$1401,$1402,$1403,$1404,$1405,$1406,$1407,$1408,$1409,$1410,$1411,$1412,$1413,$1414,$1415,$1416,$1417,$1418,$1419,$1420,$1421,$1422,$1423,$1424,$1425,$1426,$1427,$1428,$1429,$1430,$1431,$1432,$1433,$1434,$1435,$1436,$1437,$1438,$1439,$1440,$1441,$1442,$1443,$1444,$1445,$1446,$1447,$1448,$1449,$1450,$1451,$1452,$1453,$1454,$1455,$1456,$1457,$1458,$1459,$1460,$1461,$1462,$1463,$1464,$1465,$1466,$1467,$1468,$1469,$1470,$1471,$1472,$1473,$1474,$1475,$1476,$1477,$1478,$1479,$1480,$1481,$1482,$1483,$1484,$1485,$1486,$1487,$1488,$1489,$1490,$1491,$1492,$1493,$1494,$1495,$1496,$1497,$1498,$1499,$1500,$1501,$1502,$1503,$1504,$1505,$1506,$1507,$1508,$1509,$1510,$1511,$1512,$1513,$1514,$1515,$1516,$1517,$1518,$1519,$1520,$1521,$1522,$1523,$1524,$1525,$1526,$1527,$1528,$1529,$1530,$1531,$1532,$1533,$1534,$1535,$1536,$1537,$1538,$1539,$1540,$1541,$1542,$1543,$1544,$1545,$1546,$1547,$1548,$1549,$1550,$1551,$1552,$1553,$1554,$1555,$1556,$1557,$1558,$1559,$1560,$1561,$1562,$1563,$1564,$1565,$1566,$1567,$1568,$1569,$1570,$1571,$1572,$1573,$1574,$1575,$1576,$1577,$1578,$1579,$1580,$1581,$1582,$1583,$1584,$1585,$1586,$1587,$1588,$1589,$1590,$1591,$1592,$1593,$1594,$1595,$1596,$1597,$1598,$1599,$1600,$1601,$1602,$1603,$1604,$1605,$1606,$1607,$1608,$1609,$1610,$1611,$1612,$1613,$1614,$1615,$1616,$1617,$1618,$1619,$1620,$1621,$1622,$1623,$1624,$1625,$1626,$1627,$1628,$1629,$1630,$1631,$1632,$1633,$1634,$1635,$1636,$1637,$1638,$1639,$1640,$1641,$1642,$1643,$1644,$1645,$1646,$1647,$1648,$1649,$1650,$1651,$1652,$1653,$1654,$1655,$1656,$1657,$1658,$1659,$1660,$1661,$1662,$1663,$1664,$1665,$1666,$1667,$1668,$1669,$1670,$1671,$1672,$1673,$1674,$1675,$1676,$1677,$1678,$1679,$1680,$1681,$1682,$1683,$1684,$1685,$1686,$1687,$1688,$1689,$1690,$1691,$1692,$1693,$1694,$1695,$1696,$1697,$1698,$1699,$1700,$1701,$1702,$1703,$1704,$1705,$1706,$1707,$1708,$1709,$1710,$1711,$1712,$1713,$1714,$1715,$1716,$1717,$1718,$1719,$1720,$1721,$1722,$1723,$1724,$1725,$1726,$1727,$1728,$1729,$1730,$1731,$1732,$1733,$1734,$1735,$1736,$1737,$1738,$1739,$1740,$1741,$1742,$1743,$1744,$1745,$1746,$1747,$1748,$1749,$1750,$1751,$1752,$1753,$1754,$1755,$1756,$1757,$1
42 min < 0.1% 745 ms 3,423 odoo
SELECT min("stock_picking".id) AS id, count("stock_picking".id) AS "picking_type_id_count" , "stock_picking"."picking_type_id" as "picking_type_id" 
            FROM "stock_picking" LEFT JOIN "stock_picking_type" as "stock_picking__picking_type_id" ON ("stock_picking"."picking_type_id" = "stock_picking__picking_type_id"."id")
            WHERE ((("stock_picking"."state" in ($1,$2))  AND  (("stock_picking"."state" not in ($3,$4)) OR "stock_picking"."state" IS NULL))  AND  ("stock_picking"."picking_type_id" in ($5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39))) AND ("stock_picking"."company_id" IS NULL   OR  ("stock_picking"."company_id" in ($40)))
            GROUP BY "stock_picking"."picking_type_id","stock_picking__picking_type_id"."sequence","stock_picking__picking_type_id"."id"
            ORDER BY  "stock_picking__picking_type_id"."sequence" ,"stock_picking__picking_type_id"."id"
42 min < 0.1% 34 ms 74,186 odoo
SELECT "material_requisition_line".id FROM "material_requisition_line" LEFT JOIN "res_partner" as "material_requisition_line__partner_id" ON ("material_requisition_line"."partner_id" = "material_requisition_line__partner_id"."id") LEFT JOIN "product_category" as "material_requisition_line__categ_id" ON ("material_requisition_line"."categ_id" = "material_requisition_line__categ_id"."id") LEFT JOIN "product_product" as "material_requisition_line__product_id" ON ("material_requisition_line"."product_id" = "material_requisition_line__product_id"."id") WHERE ("material_requisition_line"."requisition_id" = $1) ORDER BY "material_requisition_line__partner_id"."display_name" ,"material_requisition_line__categ_id"."parent_left" ,"material_requisition_line__product_id"."default_code" ,"material_requisition_line__product_id"."id"
41 min < 0.1% 46 ms 53,915 odoo
SELECT "mrp_bom_line".id FROM "mrp_bom_line" WHERE ("mrp_bom_line"."product_id" in ($1)) ORDER BY "mrp_bom_line"."sequence" ,"mrp_bom_line"."id"
Details
CREATE INDEX CONCURRENTLY ON mrp_bom_line (product_id)
Rows: 47194
Row progression: 47194, 15

Row estimates
- product_id (=): 15
- sequence (sort): 1430
- id (sort): 1

Existing indexes
- id PRIMARY
- bom_id
41 min < 0.1% 95 ms 25,720 odoo
SELECT "product_product".id FROM "product_product" WHERE (("product_product"."active" = $1)  AND  ("product_product"."barcode"::text ilike $2)) ORDER BY "product_product"."default_code" ,"product_product"."id"
38 min < 0.1% 163 ms 14,059 odoo
SELECT min("stock_move".id) AS id, count("stock_move".id) AS "product_id_count" , sum("stock_move"."product_qty") AS "product_qty" ,"stock_move"."product_id" as "product_id" 
            FROM "stock_location" as "stock_move__location_id","stock_location" as "stock_move__location_dest_id","stock_move"
            WHERE ("stock_move"."location_id"="stock_move__location_id"."id" AND "stock_move"."location_dest_id"="stock_move__location_dest_id"."id") AND ((((("stock_move"."state" not in ($1,$2,$3)) OR "stock_move"."state" IS NULL)  AND  ("stock_move"."product_id" in ($4)))  AND  (((((((((((("stock_move__location_id"."parent_left" >= $5)  AND  ("stock_move__location_id"."parent_left" < $6))  OR  (("stock_move__location_id"."parent_left" >= $7)  AND  ("stock_move__location_id"."parent_left" < $8)))  OR  (("stock_move__location_id"."parent_left" >= $9)  AND  ("stock_move__location_id"."parent_left" < $10)))  OR  (("stock_move__location_id"."parent_left" >= $11)  AND  ("stock_move__location_id"."parent_left" < $12)))  OR  (("stock_move__location_id"."parent_left" >= $13)  AND  ("stock_move__location_id"."parent_left" < $14)))  OR  (("stock_move__location_id"."parent_left" >= $15)  AND  ("stock_move__location_id"."parent_left" < $16)))  OR  (("stock_move__location_id"."parent_left" >= $17)  AND  ("stock_move__location_id"."parent_left" < $18)))  OR  (("stock_move__location_id"."parent_left" >= $19)  AND  ("stock_move__location_id"."parent_left" < $20)))  OR  (("stock_move__location_id"."parent_left" >= $21)  AND  ("stock_move__location_id"."parent_left" < $22)))  OR  (("stock_move__location_id"."parent_left" >= $23)  AND  ("stock_move__location_id"."parent_left" < $24)))  OR  (("stock_move__location_id"."parent_left" >= $25)  AND  ("stock_move__location_id"."parent_left" < $26))))  AND  (((((((((((("stock_move__location_dest_id"."parent_left" < $27)  OR  ("stock_move__location_dest_id"."parent_left" >= $28))  AND  (("stock_move__location_dest_id"."parent_left" < $29)  OR  ("stock_move__location_dest_id"."parent_left" >= $30)))  AND  (("stock_move__location_dest_id"."parent_left" < $31)  OR  ("stock_move__location_dest_id"."parent_left" >= $32)))  AND  (("stock_move__location_dest_id"."parent_left" < $33)  OR  ("stock_move__location_dest_id"."parent_left" >= $34)))  AND  (("stock_move__location_dest_id"."parent_left" < $35)  OR  ("stock_move__location_dest_id"."parent_left" >= $36)))  AND  (("stock_move__location_dest_id"."parent_left" < $37)  OR  ("stock_move__location_dest_id"."parent_left" >= $38)))  AND  (("stock_move__location_dest_id"."parent_left" < $39)  OR  ("stock_move__location_dest_id"."parent_left" >= $40)))  AND  (("stock_move__location_dest_id"."parent_left" < $41)  OR  ("stock_move__location_dest_id"."parent_left" >= $42)))  AND  (("stock_move__location_dest_id"."parent_left" < $43)  OR  ("stock_move__location_dest_id"."parent_left" >= $44)))  AND  (("stock_move__location_dest_id"."parent_left" < $45)  OR  ("stock_move__location_dest_id"."parent_left" >= $46)))  AND  (("stock_move__location_dest_id"."parent_left" < $47)  OR  ("stock_move__location_dest_id"."parent_left" >= $48)))) AND ("stock_move"."location_dest_id"="stock_move__location_dest_id"."id") AND (("stock_move"."company_id" IS NULL   OR  ("stock_move"."company_id" in ($49)))  OR  "stock_move__location_dest_id"."company_id" IS NULL )
            GROUP BY "stock_move"."product_id"
            ORDER BY "id"
37 min < 0.1% 205 ms 10,781 odoo
SELECT "delivery_dashboard_entry".id FROM "delivery_dashboard_entry" WHERE ("delivery_dashboard_entry"."product_id" in ($1)) ORDER BY "delivery_dashboard_entry"."id"
Details
CREATE INDEX CONCURRENTLY ON delivery_dashboard_entry (product_id, id)
Rows: 172516
Row progression: 172516, 183, 0

Row estimates
- product_id (=): 183
- id (sort): 1

Existing indexes
- id PRIMARY
- do_line_id
34 min < 0.1% 54 ms 37,272 odoo
SELECT "mrp_product_produce_line".id FROM "mrp_product_produce_line" WHERE ("mrp_product_produce_line"."product_produce_id" in ($1)) ORDER BY "mrp_product_produce_line"."id"
Details
CREATE INDEX CONCURRENTLY ON mrp_product_produce_line (product_produce_id)
Rows: 164365
Row progression: 164365, 8

Row estimates
- product_produce_id (=): 8
- id (sort): 1

Existing indexes
- id PRIMARY
33 min < 0.1% 100 ms 20,093 odoo
SELECT "product_product".id FROM "product_product" WHERE ("product_product"."active" = $1) ORDER BY "product_product"."default_code" ,"product_product"."id"   limit $2
Covered by index on (active, default_code)
Rows: 1000206
Row progression: 1000206, 500103, 0

Row estimates
- active (=): 500103
- default_code (sort): 0
- id (sort): 1

Existing indexes
- id PRIMARY
- active, default_code
- barcode UNIQUE
- default_code
- product_tmpl_id
31 min < 0.1% 132 ms 14,059 odoo
SELECT min("stock_move".id) AS id, count("stock_move".id) AS "product_id_count" , sum("stock_move"."product_qty") AS "product_qty" ,"stock_move"."product_id" as "product_id" 
            FROM "stock_location" as "stock_move__location_dest_id","stock_location" as "stock_move__location_id","stock_move"
            WHERE ("stock_move"."location_id"="stock_move__location_id"."id" AND "stock_move"."location_dest_id"="stock_move__location_dest_id"."id") AND ((((("stock_move"."state" not in ($1,$2,$3)) OR "stock_move"."state" IS NULL)  AND  ("stock_move"."product_id" in ($4)))  AND  (((((("stock_move__location_dest_id"."parent_left" >= $5)  AND  ("stock_move__location_dest_id"."parent_left" < $6))  OR  (("stock_move__location_dest_id"."parent_left" >= $7)  AND  ("stock_move__location_dest_id"."parent_left" < $8)))  OR  (("stock_move__location_dest_id"."parent_left" >= $9)  AND  ("stock_move__location_dest_id"."parent_left" < $10)))  OR  (("stock_move__location_dest_id"."parent_left" >= $11)  AND  ("stock_move__location_dest_id"."parent_left" < $12)))  OR  ("stock_move"."location_dest_id" in ($13))))  AND  (((((("stock_move__location_id"."parent_left" < $14)  OR  ("stock_move__location_id"."parent_left" >= $15))  AND  (("stock_move__location_id"."parent_left" < $16)  OR  ("stock_move__location_id"."parent_left" >= $17)))  AND  (("stock_move__location_id"."parent_left" < $18)  OR  ("stock_move__location_id"."parent_left" >= $19)))  AND  (("stock_move__location_id"."parent_left" < $20)  OR  ("stock_move__location_id"."parent_left" >= $21)))  AND  (NOT (("stock_move"."location_id" in ($22)))))) AND ("stock_move"."location_dest_id"="stock_move__location_dest_id"."id") AND (("stock_move"."company_id" IS NULL   OR  ("stock_move"."company_id" in ($23)))  OR  "stock_move__location_dest_id"."company_id" IS NULL )
            GROUP BY "stock_move"."product_id"
            ORDER BY "id"
30 min < 0.1% 7,474 ms 242 odoo
UPDATE "stock_quant" SET "reserved_quantity"=$1,"write_uid"=$2,"write_date"=(now() at time zone $3) WHERE id IN ($4)
Covered by index on (id)
Rows: 2763589
Row progression: 2763589, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- lot_id
- product_id
29 min < 0.1% 10,905 ms 157 odoo
SELECT "stock_move".id FROM "stock_move" LEFT JOIN "stock_picking" as "stock_move__picking_id" ON ("stock_move"."picking_id" = "stock_move__picking_id"."id") WHERE ("stock_move"."sale_line_id" in (13792978,13792979,13792980,13792981,13792982)) ORDER BY "stock_move__picking_id"."priority" DESC,"stock_move__picking_id"."date" ASC,"stock_move__picking_id"."id" DESC,"stock_move"."sequence" ,"stock_move"."id"
28 min < 0.1% 120 ms 13,984 odoo
SELECT min("stock_move".id) AS id, count("stock_move".id) AS "product_id_count" , sum("stock_move"."product_qty") AS "product_qty" ,"stock_move"."product_id" as "product_id" 
            FROM "stock_location" as "stock_move__location_id","stock_location" as "stock_move__location_dest_id","stock_move"
            WHERE ("stock_move"."location_id"="stock_move__location_id"."id" AND "stock_move"."location_dest_id"="stock_move__location_dest_id"."id") AND ((((("stock_move"."state" not in ($1,$2,$3)) OR "stock_move"."state" IS NULL)  AND  ("stock_move"."product_id" in ($4)))  AND  ((((((((((((("stock_move__location_id"."parent_left" >= $5)  AND  ("stock_move__location_id"."parent_left" < $6))  OR  (("stock_move__location_id"."parent_left" >= $7)  AND  ("stock_move__location_id"."parent_left" < $8)))  OR  (("stock_move__location_id"."parent_left" >= $9)  AND  ("stock_move__location_id"."parent_left" < $10)))  OR  (("stock_move__location_id"."parent_left" >= $11)  AND  ("stock_move__location_id"."parent_left" < $12)))  OR  (("stock_move__location_id"."parent_left" >= $13)  AND  ("stock_move__location_id"."parent_left" < $14)))  OR  (("stock_move__location_id"."parent_left" >= $15)  AND  ("stock_move__location_id"."parent_left" < $16)))  OR  (("stock_move__location_id"."parent_left" >= $17)  AND  ("stock_move__location_id"."parent_left" < $18)))  OR  (("stock_move__location_id"."parent_left" >= $19)  AND  ("stock_move__location_id"."parent_left" < $20)))  OR  (("stock_move__location_id"."parent_left" >= $21)  AND  ("stock_move__location_id"."parent_left" < $22)))  OR  (("stock_move__location_id"."parent_left" >= $23)  AND  ("stock_move__location_id"."parent_left" < $24)))  OR  (("stock_move__location_id"."parent_left" >= $25)  AND  ("stock_move__location_id"."parent_left" < $26)))  OR  (("stock_move__location_id"."parent_left" >= $27)  AND  ("stock_move__location_id"."parent_left" < $28))))  AND  ((((((((((((("stock_move__location_dest_id"."parent_left" < $29)  OR  ("stock_move__location_dest_id"."parent_left" >= $30))  AND  (("stock_move__location_dest_id"."parent_left" < $31)  OR  ("stock_move__location_dest_id"."parent_left" >= $32)))  AND  (("stock_move__location_dest_id"."parent_left" < $33)  OR  ("stock_move__location_dest_id"."parent_left" >= $34)))  AND  (("stock_move__location_dest_id"."parent_left" < $35)  OR  ("stock_move__location_dest_id"."parent_left" >= $36)))  AND  (("stock_move__location_dest_id"."parent_left" < $37)  OR  ("stock_move__location_dest_id"."parent_left" >= $38)))  AND  (("stock_move__location_dest_id"."parent_left" < $39)  OR  ("stock_move__location_dest_id"."parent_left" >= $40)))  AND  (("stock_move__location_dest_id"."parent_left" < $41)  OR  ("stock_move__location_dest_id"."parent_left" >= $42)))  AND  (("stock_move__location_dest_id"."parent_left" < $43)  OR  ("stock_move__location_dest_id"."parent_left" >= $44)))  AND  (("stock_move__location_dest_id"."parent_left" < $45)  OR  ("stock_move__location_dest_id"."parent_left" >= $46)))  AND  (("stock_move__location_dest_id"."parent_left" < $47)  OR  ("stock_move__location_dest_id"."parent_left" >= $48)))  AND  (("stock_move__location_dest_id"."parent_left" < $49)  OR  ("stock_move__location_dest_id"."parent_left" >= $50)))  AND  (("stock_move__location_dest_id"."parent_left" < $51)  OR  ("stock_move__location_dest_id"."parent_left" >= $52)))) AND ("stock_move"."location_dest_id"="stock_move__location_dest_id"."id") AND (("stock_move"."company_id" IS NULL   OR  ("stock_move"."company_id" in ($53)))  OR  "stock_move__location_dest_id"."company_id" IS NULL )
            GROUP BY "stock_move"."product_id"
            ORDER BY "id"
27 min < 0.1% 114 ms 14,059 odoo
SELECT min("stock_move".id) AS id, count("stock_move".id) AS "product_id_count" , sum("stock_move"."product_qty") AS "product_qty" ,"stock_move"."product_id" as "product_id" 
            FROM "stock_location" as "stock_move__location_id","stock_location" as "stock_move__location_dest_id","stock_move"
            WHERE ("stock_move"."location_id"="stock_move__location_id"."id" AND "stock_move"."location_dest_id"="stock_move__location_dest_id"."id") AND ((((("stock_move"."state" not in ($1,$2,$3)) OR "stock_move"."state" IS NULL)  AND  ("stock_move"."product_id" in ($4)))  AND  (((((("stock_move__location_id"."parent_left" >= $5)  AND  ("stock_move__location_id"."parent_left" < $6))  OR  (("stock_move__location_id"."parent_left" >= $7)  AND  ("stock_move__location_id"."parent_left" < $8)))  OR  (("stock_move__location_id"."parent_left" >= $9)  AND  ("stock_move__location_id"."parent_left" < $10)))  OR  (("stock_move__location_id"."parent_left" >= $11)  AND  ("stock_move__location_id"."parent_left" < $12)))  OR  ("stock_move"."location_id" in ($13))))  AND  (((((("stock_move__location_dest_id"."parent_left" < $14)  OR  ("stock_move__location_dest_id"."parent_left" >= $15))  AND  (("stock_move__location_dest_id"."parent_left" < $16)  OR  ("stock_move__location_dest_id"."parent_left" >= $17)))  AND  (("stock_move__location_dest_id"."parent_left" < $18)  OR  ("stock_move__location_dest_id"."parent_left" >= $19)))  AND  (("stock_move__location_dest_id"."parent_left" < $20)  OR  ("stock_move__location_dest_id"."parent_left" >= $21)))  AND  (NOT (("stock_move"."location_dest_id" in ($22)))))) AND ("stock_move"."location_dest_id"="stock_move__location_dest_id"."id") AND (("stock_move"."company_id" IS NULL   OR  ("stock_move"."company_id" in ($23)))  OR  "stock_move__location_dest_id"."company_id" IS NULL )
            GROUP BY "stock_move"."product_id"
            ORDER BY "id"
24 min < 0.1% 43 ms 33,879 odoo
SELECT min("stock_move".id) AS id, count("stock_move".id) AS "product_id_count" , sum("stock_move"."product_qty") AS "product_qty" ,"stock_move"."product_id" as "product_id" 
            FROM "stock_move" LEFT JOIN "product_product" as "stock_move__product_id" ON ("stock_move"."product_id" = "stock_move__product_id"."id"),"stock_location" as "stock_move__location_dest_id"
            WHERE (((("stock_move"."location_dest_id" = $1)  AND  ("stock_move"."state" = $2))  AND  ("stock_move"."product_id" in ($3)))  AND  ("stock_move"."date" >= $4)) AND ("stock_move"."location_dest_id"="stock_move__location_dest_id"."id") AND (("stock_move"."company_id" IS NULL   OR  ("stock_move"."company_id" in ($5)))  OR  "stock_move__location_dest_id"."company_id" IS NULL )
            GROUP BY "stock_move"."product_id","stock_move__product_id"."default_code","stock_move__product_id"."id"
            ORDER BY  "stock_move__product_id"."default_code" ,"stock_move__product_id"."id"
24 min < 0.1% 30 ms 46,574 odoo
SELECT min("mrp_production".id) AS id, count("mrp_production".id) AS "product_id_count" , "mrp_production"."product_id" as "product_id" 
            FROM "mrp_production" LEFT JOIN "product_product" as "mrp_production__product_id" ON ("mrp_production"."product_id" = "mrp_production__product_id"."id")
            WHERE ("mrp_production"."product_id" in ($1)) AND (("mrp_production"."company_id" in ($2))  OR  "mrp_production"."company_id" IS NULL )
            GROUP BY "mrp_production"."product_id","mrp_production__product_id"."default_code","mrp_production__product_id"."id"
            ORDER BY  "mrp_production__product_id"."default_code" ,"mrp_production__product_id"."id"
18 min < 0.1% 151 ms 7,146 odoo
SELECT "product_template".id FROM "product_template" LEFT JOIN 
                (SELECT DISTINCT ON (res_id) res_id, value
                 FROM "ir_translation"
                 WHERE name=$1 AND lang=$2 AND value!=$3
                 ORDER BY res_id, id DESC)
             as "product_template__name" ON ("product_template"."id" = "product_template__name"."res_id") WHERE (("product_template"."active" = $4)  AND  (("product_template"."id" in (WITH temp_irt_current (id, name) as (
                            SELECT ct.id, coalesce(it.value,ct."name")
                            FROM product_template ct
                            LEFT JOIN ir_translation it ON (it.name = $5 and
                                        it.lang = $6 and
                                        it.type = $7 and
                                        it.res_id = ct.id and
                                        it.value != $8)
                            )
                            SELECT id FROM temp_irt_current WHERE name ilike $9 order by name
                            ))  OR  $10)) ORDER BY COALESCE("product_template__name"."value", "product_template"."name")   limit $11
18 min < 0.1% 2,262 ms 468 odoo
SELECT min("stock_move".id) AS id, count("stock_move".id) AS "product_id_count" , sum("stock_move"."product_qty") AS "product_qty" ,"stock_move"."product_id" as "product_id" 
            FROM "stock_location" as "stock_move__location_dest_id","stock_location" as "stock_move__location_id","stock_move"
            WHERE ("stock_move"."location_dest_id"="stock_move__location_dest_id"."id" AND "stock_move"."location_id"="stock_move__location_id"."id") AND ((((("stock_move"."state" not in ($1,$2,$3)) OR "stock_move"."state" IS NULL)  AND  ("stock_move"."product_id" in ($4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$80,$81,$82,$83,$84,$85,$86,$87,$88,$89,$90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$100,$101,$102,$103,$104,$105,$106,$107,$108,$109,$110,$111,$112,$113,$114,$115,$116,$117,$118,$119,$120,$121,$122,$123,$124,$125,$126,$127,$128,$129,$130,$131,$132,$133,$134,$135,$136,$137,$138,$139,$140,$141,$142,$143,$144,$145,$146,$147,$148,$149,$150,$151,$152,$153,$154,$155,$156,$157,$158,$159,$160,$161,$162,$163,$164,$165,$166,$167,$168,$169,$170,$171,$172,$173,$174,$175,$176,$177,$178,$179,$180,$181,$182,$183,$184,$185,$186,$187,$188,$189,$190,$191,$192,$193,$194,$195,$196,$197,$198,$199,$200,$201,$202,$203,$204,$205,$206,$207,$208,$209,$210,$211,$212,$213,$214,$215,$216,$217,$218,$219,$220,$221,$222,$223,$224,$225,$226,$227,$228,$229,$230,$231,$232,$233,$234,$235,$236,$237,$238,$239,$240,$241,$242,$243,$244,$245,$246,$247,$248,$249,$250,$251,$252,$253,$254,$255,$256,$257,$258,$259,$260,$261,$262,$263,$264,$265,$266,$267,$268,$269,$270,$271,$272,$273,$274,$275,$276,$277,$278,$279,$280,$281,$282,$283,$284,$285,$286,$287,$288,$289,$290,$291,$292,$293,$294,$295,$296,$297,$298,$299,$300,$301,$302,$303,$304,$305,$306,$307,$308,$309,$310,$311,$312,$313,$314,$315,$316,$317,$318,$319,$320,$321,$322,$323,$324,$325,$326,$327,$328,$329,$330,$331,$332,$333,$334,$335,$336,$337,$338,$339,$340,$341,$342,$343,$344,$345,$346,$347,$348,$349,$350,$351,$352,$353,$354,$355,$356,$357,$358,$359,$360,$361,$362,$363,$364,$365,$366,$367,$368,$369,$370,$371,$372,$373,$374,$375,$376,$377,$378,$379,$380,$381,$382,$383,$384,$385,$386,$387,$388,$389,$390,$391,$392,$393,$394,$395,$396,$397,$398,$399,$400,$401,$402,$403,$404,$405,$406,$407,$408,$409,$410,$411,$412,$413,$414,$415,$416,$417,$418,$419,$420,$421,$422,$423,$424,$425,$426,$427,$428,$429,$430,$431,$432,$433,$434,$435,$436,$437,$438,$439,$440,$441,$442,$443,$444,$445,$446,$447,$448,$449,$450,$451,$452,$453,$454,$455,$456,$457,$458,$459,$460,$461,$462,$463,$464,$465,$466,$467,$468,$469,$470,$471,$472,$473,$474,$475,$476,$477,$478,$479,$480,$481,$482,$483,$484,$485,$486,$487,$488,$489,$490,$491,$492,$493,$494,$495,$496,$497,$498,$499,$500,$501,$502,$503,$504,$505,$506,$507,$508,$509,$510,$511,$512,$513,$514,$515,$516,$517,$518,$519,$520,$521,$522,$523,$524,$525,$526,$527,$528,$529,$530,$531,$532,$533,$534,$535,$536,$537,$538,$539,$540,$541,$542,$543,$544,$545,$546,$547,$548,$549,$550,$551,$552,$553,$554,$555,$556,$557,$558,$559,$560,$561,$562,$563,$564,$565,$566,$567,$568,$569,$570,$571,$572,$573,$574,$575,$576,$577,$578,$579,$580,$581,$582,$583,$584,$585,$586,$587,$588,$589,$590,$591,$592,$593,$594,$595,$596,$597,$598,$599,$600,$601,$602,$603,$604,$605,$606,$607,$608,$609,$610,$611,$612,$613,$614,$615,$616,$617,$618,$619,$620,$621,$622,$623,$624,$625,$626,$627,$628)))  AND  ((((((((((((("stock_move__location_dest_id"."parent_left" >= $629)  AND  ("stock_move__location_dest_id"."parent_left" < $630))  OR  (("stock_move__location_dest_id"."parent_left" >= $631)  AND  ("stock_move__location_dest_id"."parent_left" < $632)))  OR  (("stock_move__location_dest_id"."parent_left" >= $633)  AND  ("stock_move__location_dest_id"."parent_left" < $634)))  OR  (("stock_move__location_dest_id"."parent_left" >= $635)  AND  ("stock_move__location_dest_id"."parent_left" < $636)))  OR  (("stock_move__location_dest_id"."parent_left" >= $637)  AND  ("stock_move__location_dest_id"."parent_left" < $638)))  OR  (("stock_move__location_dest_id"."parent_left" >= $639)  AND  ("stock_move__location_dest_id"."parent_left" < $640)))  OR  (("stock_move__location_dest_id"."parent_left" >= $641)  AND  ("stock_move__location_dest_id"."parent_left" < $642)))  OR  (("stock_move__location_dest_id"."parent_left" >= $643)  AND  ("stock_move__location_dest_id"."parent_left" < $644)))  OR  (("stock_move__location_dest_id"."parent_left" >= $645)  AND  ("stock_move__location_dest_id"."parent_left" < $646)))  OR  (("stock_move__location_dest_id"."parent_left" >= $647)  AND  ("stock_move__location_dest_id"."parent_left" < $648)))  OR  (("stock_move__location_dest_id"."parent_left" >= $649)  AND  ("stock_move__location_dest_id"."parent_left" < $650)))  OR  (("stock_move__location_dest_id"."parent_left" >= $651)  AND  ("stock_move__location_dest_id"."parent_left" < $652))))  AND  ((((((((((((("stock_move__location_id"."parent_left" < $653)  OR  ("stock_move__location_id"."parent_left" >= $654))  AND  (("stock_move__location_id"."parent_left" < $655)  OR  ("stock_move__location_id"."parent_left" >= $656)))  AND  (("stock_move__location_id"."parent_left" < $657)  OR  ("stock_move__location_id"."parent_left" >= $658)))  AND  (("stock_move__location_id"."parent_left" < $659)  OR  ("stock_move__location_id"."parent_left" >= $660)))  AND  (("stock_move__location_id"."parent_left" < $661)  OR  ("stock_move__location_id"."parent_left" >= $662)))  AND  (("stock_move__location_id"."parent_left" < $663)  OR  ("stock_move__location_id"."parent_left" >= $664)))  AND  (("stock_move__location_id"."parent_left" < $665)  OR  ("stock_move__location_id"."parent_left" >= $666)))  AND  (("stock_move__location_id"."parent_left" < $667)  OR  ("stock_move__location_id"."parent_left" >= $668)))  AND  (("stock_move__location_id"."parent_left" < $669)  OR  ("stock_move__location_id"."parent_left" >= $670)))  AND  (("stock_move__location_id"."parent_left" < $671)  OR  ("stock_move__location_id"."parent_left" >= $672)))  AND  (("stock_move__location_id"."parent_left" < $673)  OR  ("stock_move__location_id"."parent_left" >= $674)))  AND  (("stock_move__location_id"."parent_left" < $675)  OR  ("stock_move__location_id"."parent_left" >= $676))))
            GROUP BY "stock_move"."product_id"
            ORDER BY "id"
17 min < 0.1% 2,368 ms 439 odoo
SELECT min("stock_move".id) AS id, count("stock_move".id) AS "product_id_count" , sum("stock_move"."product_qty") AS "product_qty" ,"stock_move"."product_id" as "product_id" 
            FROM "stock_location" as "stock_move__location_dest_id","stock_location" as "stock_move__location_id","stock_move"
            WHERE ("stock_move"."location_dest_id"="stock_move__location_dest_id"."id" AND "stock_move"."location_id"="stock_move__location_id"."id") AND ((((("stock_move"."state" not in ($1,$2,$3)) OR "stock_move"."state" IS NULL)  AND  ("stock_move"."product_id" in ($4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$80,$81,$82,$83,$84,$85,$86,$87,$88,$89,$90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$100,$101,$102,$103,$104,$105,$106,$107,$108,$109,$110,$111,$112,$113,$114,$115,$116,$117,$118,$119,$120,$121,$122,$123,$124,$125,$126,$127,$128,$129,$130,$131,$132,$133,$134,$135,$136,$137,$138,$139,$140,$141,$142,$143,$144,$145,$146,$147,$148,$149,$150,$151,$152,$153,$154,$155,$156,$157,$158,$159,$160,$161,$162,$163,$164,$165,$166,$167,$168,$169,$170,$171,$172,$173,$174,$175,$176,$177,$178,$179,$180,$181,$182,$183,$184,$185,$186,$187,$188,$189,$190,$191,$192,$193,$194,$195,$196,$197,$198,$199,$200,$201,$202,$203,$204,$205,$206,$207,$208,$209,$210,$211,$212,$213,$214,$215,$216,$217,$218,$219,$220,$221,$222,$223,$224,$225,$226,$227,$228,$229,$230,$231,$232,$233,$234,$235,$236,$237,$238,$239,$240,$241,$242,$243,$244,$245,$246,$247,$248,$249,$250,$251,$252,$253,$254,$255,$256,$257,$258,$259,$260,$261,$262,$263,$264,$265,$266,$267,$268,$269,$270,$271,$272,$273,$274,$275,$276,$277,$278,$279,$280,$281,$282,$283,$284,$285,$286,$287,$288,$289,$290,$291,$292,$293,$294,$295,$296,$297,$298,$299,$300,$301,$302,$303,$304,$305,$306,$307,$308,$309,$310,$311,$312,$313,$314,$315,$316,$317,$318,$319,$320,$321,$322,$323,$324,$325,$326,$327,$328,$329,$330,$331,$332,$333,$334,$335,$336,$337,$338,$339,$340,$341,$342,$343,$344,$345,$346,$347,$348,$349,$350,$351,$352,$353,$354,$355,$356,$357,$358,$359,$360,$361,$362,$363,$364,$365,$366,$367,$368,$369,$370,$371,$372,$373,$374,$375,$376,$377,$378,$379,$380,$381,$382,$383,$384,$385,$386,$387,$388,$389,$390,$391,$392,$393,$394,$395,$396,$397,$398,$399,$400,$401,$402,$403,$404,$405,$406,$407,$408,$409,$410,$411,$412,$413,$414,$415,$416,$417,$418,$419,$420,$421,$422,$423,$424,$425,$426,$427,$428,$429,$430,$431,$432,$433,$434,$435,$436,$437,$438,$439,$440,$441,$442,$443,$444,$445,$446,$447,$448,$449,$450,$451,$452,$453,$454,$455,$456,$457,$458,$459,$460,$461,$462,$463,$464,$465,$466,$467,$468,$469,$470,$471,$472,$473,$474,$475,$476,$477,$478,$479,$480,$481,$482,$483,$484,$485,$486,$487,$488,$489,$490,$491,$492,$493,$494,$495,$496,$497,$498,$499,$500,$501,$502,$503,$504,$505,$506,$507,$508,$509,$510,$511,$512,$513,$514,$515,$516,$517,$518,$519,$520,$521,$522,$523,$524,$525,$526,$527,$528,$529,$530,$531,$532,$533,$534,$535,$536,$537,$538,$539,$540,$541,$542,$543,$544,$545,$546,$547,$548,$549,$550,$551,$552,$553,$554,$555,$556,$557,$558,$559,$560,$561,$562,$563,$564,$565,$566,$567,$568,$569,$570,$571,$572,$573,$574,$575,$576,$577,$578,$579,$580,$581,$582,$583,$584,$585,$586,$587,$588,$589,$590,$591,$592,$593,$594,$595,$596,$597,$598,$599,$600,$601,$602,$603,$604,$605,$606,$607,$608,$609,$610,$611,$612,$613,$614,$615,$616,$617,$618,$619,$620,$621,$622)))  AND  ((((((((((((("stock_move__location_dest_id"."parent_left" >= $623)  AND  ("stock_move__location_dest_id"."parent_left" < $624))  OR  (("stock_move__location_dest_id"."parent_left" >= $625)  AND  ("stock_move__location_dest_id"."parent_left" < $626)))  OR  (("stock_move__location_dest_id"."parent_left" >= $627)  AND  ("stock_move__location_dest_id"."parent_left" < $628)))  OR  (("stock_move__location_dest_id"."parent_left" >= $629)  AND  ("stock_move__location_dest_id"."parent_left" < $630)))  OR  (("stock_move__location_dest_id"."parent_left" >= $631)  AND  ("stock_move__location_dest_id"."parent_left" < $632)))  OR  (("stock_move__location_dest_id"."parent_left" >= $633)  AND  ("stock_move__location_dest_id"."parent_left" < $634)))  OR  (("stock_move__location_dest_id"."parent_left" >= $635)  AND  ("stock_move__location_dest_id"."parent_left" < $636)))  OR  (("stock_move__location_dest_id"."parent_left" >= $637)  AND  ("stock_move__location_dest_id"."parent_left" < $638)))  OR  (("stock_move__location_dest_id"."parent_left" >= $639)  AND  ("stock_move__location_dest_id"."parent_left" < $640)))  OR  (("stock_move__location_dest_id"."parent_left" >= $641)  AND  ("stock_move__location_dest_id"."parent_left" < $642)))  OR  (("stock_move__location_dest_id"."parent_left" >= $643)  AND  ("stock_move__location_dest_id"."parent_left" < $644)))  OR  (("stock_move__location_dest_id"."parent_left" >= $645)  AND  ("stock_move__location_dest_id"."parent_left" < $646))))  AND  ((((((((((((("stock_move__location_id"."parent_left" < $647)  OR  ("stock_move__location_id"."parent_left" >= $648))  AND  (("stock_move__location_id"."parent_left" < $649)  OR  ("stock_move__location_id"."parent_left" >= $650)))  AND  (("stock_move__location_id"."parent_left" < $651)  OR  ("stock_move__location_id"."parent_left" >= $652)))  AND  (("stock_move__location_id"."parent_left" < $653)  OR  ("stock_move__location_id"."parent_left" >= $654)))  AND  (("stock_move__location_id"."parent_left" < $655)  OR  ("stock_move__location_id"."parent_left" >= $656)))  AND  (("stock_move__location_id"."parent_left" < $657)  OR  ("stock_move__location_id"."parent_left" >= $658)))  AND  (("stock_move__location_id"."parent_left" < $659)  OR  ("stock_move__location_id"."parent_left" >= $660)))  AND  (("stock_move__location_id"."parent_left" < $661)  OR  ("stock_move__location_id"."parent_left" >= $662)))  AND  (("stock_move__location_id"."parent_left" < $663)  OR  ("stock_move__location_id"."parent_left" >= $664)))  AND  (("stock_move__location_id"."parent_left" < $665)  OR  ("stock_move__location_id"."parent_left" >= $666)))  AND  (("stock_move__location_id"."parent_left" < $667)  OR  ("stock_move__location_id"."parent_left" >= $668)))  AND  (("stock_move__location_id"."parent_left" < $669)  OR  ("stock_move__location_id"."parent_left" >= $670))))
            GROUP BY "stock_move"."product_id"
            ORDER BY "id"