根据user_id
我在子句中使用的查询,我遇到了性能问题WHERE
。
这个问题描述了一个非常相似的问题,但不完全相同:
这是我的查询:
select inlineview.user_search_id, inlineview.user_id,
to_char(timezone('UTC', to_timestamp(date_part('epoch',
inlineview.last_access_date))),'YYYY-MM-DD"T"HH24:MI:SS.MSZ')
last_access_date,
to_char(timezone('UTC', to_timestamp(date_part('epoch',
inlineview.sys_creation_date))),'YYYY-MM-DD"T"HH24:MI:SS.MSZ')
sys_creation_date, b.product_id,
to_char(timezone('UTC', to_timestamp(date_part('epoch',
b.last_prov_change))),'YYYY-MM-DD"T"HH24:MI:SS.MSZ')
last_prov_change,b.product_type,b.tlc_id,b.prod_history_id,
coalesce(d.address_id,-1) address_id,coalesce(d.locality_name,'')
locality_name,
coalesce(d.post_code_zone,'') post_code_zone,
coalesce(d.road_name_concat,'')
road_name_concat,coalesce(d.street_num_concat,'') street_num_concat,
coalesce(d.address_name,'') address_name,
coalesce(d.town_name,'') town_name
from
(select a.user_search_id,
a.user_id,a.last_access_date,
a.sys_creation_date,a.product_id
from linetest.user_search a
where a.user_id = '818901'
order by a.last_access_date desc limit 10) inlineview,
linetest.prod_history b left outer join linetest.address d on d.tlc_id = b.tlc_id
where b.product_id = inlineview.product_id
and b.prod_history_id = (select c.prod_history_id
from linetest.prod_history c
where …
Run Code Online (Sandbox Code Playgroud) postgresql performance index execution-plan postgresql-performance