With Pascal's suggestion, I added a new index: CREATE INDEX fm_order_sid_type_idx ON fm_order (session_id, type);
which improved the query to 2mS! https://explain.depesz.com/s/oxvs Thank you, Pascal! On Thu, Jan 24, 2019 at 9:52 AM Jan Nielsen <jan.sture.niel...@gmail.com> wrote: > > > On Wed, Jan 23, 2019 at 12:37 PM legrand legrand < > legrand_legr...@hotmail.com> wrote: > >> Hi, >> is there an index on >> fm_order(session_id,type)? >> > > There isn't at the moment: > > table_name | index_name | column_name > ----------------+------------------------------+------------- > fm_account | fm_account_pkey | id > fm_account | uk_5p6qalvucbxmw9u64wf0aif9d | name > fm_allocation | fm_allocation_pkey | id > fm_approval | fm_approval_pkey | id > fm_capital | fm_capital_pkey | id > fm_grant | fm_grant_pkey | id > fm_market | fm_market_pkey | id > fm_marketplace | fm_marketplace_pkey | id > fm_order | fm_order_pkey | id > fm_person | fm_person_pkey | id > fm_session | fm_session_pkey | id > fm_trader | fm_trader_pkey | id > > > > >> >> regards >> PAscal > >