I mentioned this offhand in a post about a different topic, but I think this deserves its own thread.
In the process of trying to optimize some saved queries and reports, we discovered that the VPD profile has a dramatic effect on query execution time. The queries in question access, in particular, the order_release and shipment tables and the view_shipment_order_release view. For one particular sample query, which returns zero rows, execution takes between 0.1 and 5 seconds from sqlplus and between 1 and 5 minutes after a VPD profile has been applied with a call to the vpd.set_user('TMS.ADMIN') function.
I believe that this command is actually called with user DBA.ADMIN when we connect to the database via sqlplus, but the DBA.ADMIN VPD profile does not seem to be affecting the query performance.
We have been going back and forth with Oracle support about this issue for some time; they have sent us scripts to test performance with additional indexes (nothing has worked so far).
Here is a sample query (not a thing of beauty, I must say):
SELECT
glog_util.remove_domain(ORLS.ORDER_RELEASE_GID) ORDER_RELEASE,
glog_util.remove_domain(orls.source_location_gid) OR_ORIGIN,
oo.location_name OR_O_NAME,
oo.country_code3_gid OR_O_CTRY,
oo.postal_code OR_O_PC,
oo.city OR_O_CITY,
glog_util.remove_domain(orp.STATUS_VALUE_GID) OR_PLANNING,
orls.late_pickup_date OR_LATEST_PICKUP,
orls.total_weight OR_GROSS_WEIGHT,
glog_util.remove_domain(shiplist.shipment_gid) SHIPMENT_ID,
glog_util.remove_domain(sr.shipment_refnum_value) LOAD_PLAN,
glog_util.remove_domain(sgd.ship_group_gid) SHIPMENT_GROUP_ID,
glog_util.remove_domain(s.servprov_gid) CARRIER,
s.start_time S_START_TIME,
glog_util.remove_domain(s.source_location_gid) SHIP_ORIGIN,
so.location_name SHIP_O_NAME,
so.country_code3_gid SHIP_O_CTRY,
so.postal_code SHIP_O_PC,
so.city SHIP_O_CITY,
s.total_weight S_WEIGHT
FROM
order_release orls,
order_release_status ors,
order_release_status orp,
shipment_refnum sr,
shipment s,
location so,
location oo,
ship_group_d sgd,
view_shipment_order_release shiplist
where
orls.order_release_gid = ors.order_release_gid
and ors.status_type_gid ='TMS.LOAD_PLAN_OR'
and ors.status_value_gid = 'TMS.NOT CONFIRMED'
and orls.order_release_gid = orp.order_release_gid
and orp.status_type_gid='TMS.PLANNING'
and orls.source_location_gid = oo.location_gid
and orls.order_release_gid = shiplist.order_release_gid
and shiplist.shipment_gid = sr.shipment_gid
and sr.shipment_refnum_qual_gid = 'TMS.LOAD_PLAN'
and shiplist.shipment_gid = s.shipment_gid
and s.shipment_gid = sgd.shipment_gid (+)
and s.source_location_gid = so.location_gid
and orls.late_pickup_date between to_date('19/05/2005','DD/MM/YYYY')
and to_date('20/05/2005','DD/MM/YYYY')
Does anyone have any suggestions?
In the process of trying to optimize some saved queries and reports, we discovered that the VPD profile has a dramatic effect on query execution time. The queries in question access, in particular, the order_release and shipment tables and the view_shipment_order_release view. For one particular sample query, which returns zero rows, execution takes between 0.1 and 5 seconds from sqlplus and between 1 and 5 minutes after a VPD profile has been applied with a call to the vpd.set_user('TMS.ADMIN') function.
I believe that this command is actually called with user DBA.ADMIN when we connect to the database via sqlplus, but the DBA.ADMIN VPD profile does not seem to be affecting the query performance.
We have been going back and forth with Oracle support about this issue for some time; they have sent us scripts to test performance with additional indexes (nothing has worked so far).
Here is a sample query (not a thing of beauty, I must say):
SELECT
glog_util.remove_domain(ORLS.ORDER_RELEASE_GID) ORDER_RELEASE,
glog_util.remove_domain(orls.source_location_gid) OR_ORIGIN,
oo.location_name OR_O_NAME,
oo.country_code3_gid OR_O_CTRY,
oo.postal_code OR_O_PC,
oo.city OR_O_CITY,
glog_util.remove_domain(orp.STATUS_VALUE_GID) OR_PLANNING,
orls.late_pickup_date OR_LATEST_PICKUP,
orls.total_weight OR_GROSS_WEIGHT,
glog_util.remove_domain(shiplist.shipment_gid) SHIPMENT_ID,
glog_util.remove_domain(sr.shipment_refnum_value) LOAD_PLAN,
glog_util.remove_domain(sgd.ship_group_gid) SHIPMENT_GROUP_ID,
glog_util.remove_domain(s.servprov_gid) CARRIER,
s.start_time S_START_TIME,
glog_util.remove_domain(s.source_location_gid) SHIP_ORIGIN,
so.location_name SHIP_O_NAME,
so.country_code3_gid SHIP_O_CTRY,
so.postal_code SHIP_O_PC,
so.city SHIP_O_CITY,
s.total_weight S_WEIGHT
FROM
order_release orls,
order_release_status ors,
order_release_status orp,
shipment_refnum sr,
shipment s,
location so,
location oo,
ship_group_d sgd,
view_shipment_order_release shiplist
where
orls.order_release_gid = ors.order_release_gid
and ors.status_type_gid ='TMS.LOAD_PLAN_OR'
and ors.status_value_gid = 'TMS.NOT CONFIRMED'
and orls.order_release_gid = orp.order_release_gid
and orp.status_type_gid='TMS.PLANNING'
and orls.source_location_gid = oo.location_gid
and orls.order_release_gid = shiplist.order_release_gid
and shiplist.shipment_gid = sr.shipment_gid
and sr.shipment_refnum_qual_gid = 'TMS.LOAD_PLAN'
and shiplist.shipment_gid = s.shipment_gid
and s.shipment_gid = sgd.shipment_gid (+)
and s.source_location_gid = so.location_gid
and orls.late_pickup_date between to_date('19/05/2005','DD/MM/YYYY')
and to_date('20/05/2005','DD/MM/YYYY')
Does anyone have any suggestions?
Comment