Diplaying which partition a row came from in a select

A useful snippet that I've wanted to use in the past and discovered by accident.

If you want to know which partition a row came from you can use the following code:

select a.published_date,
       (select subobject_name
          from all_objects
         where object_id = dbms_mview.pmarker(a.rowid))
  from power_reporting.data_interface a
 where rownum < 2

Comments