For solving problem I started with gathering statistics:
begin dbms_stats.gather_system_stats(); end; / begin dbms_stats.gather_fixed_objects_stats(); end; / begin dbms_stats.gather_dictionary_stats(); end;After that queries on dba_free_space was little bit faster, but still slow.
Than I tried to view really what was behind dba_free_space and found that it also queries recyclebin and if in your recyclebin is many objects than it will be cause of slow queries on dba_free_space :
select TEXT from dba_views where view_name='DBA_FREE_SPACE'; select ts.name, fi.file#, f.block#, f.length * ts.blocksize, f.length, f.file# from sys.ts$ ts, sys.fet$ f, sys.file$ fi where ts.ts# = f.ts# and f.ts# = fi.ts# and f.file# = fi.relfile# and ts.bitmapped = 0 union all select ts.name, fi.file#, f.ktfbfebno, f.ktfbfeblks * ts.blocksize, f.ktfbfeblks, f.ktfbfefno from sys.ts$ ts, sys.x$ktfbfe f, sys.file$ fi where ts.ts# = f.ktfbfetsn and f.ktfbfetsn = fi.ts# and f.ktfbfefno = fi.relfile# and ts.bitmapped <> 0 and ts.online$ in (1,4) and ts.contents$ = 0 and bitand(ts.flags, 4503599627370496) <> 4503599627370496 union all select ts.name, fi.file#, u.ktfbuebno, u.ktfbueblks * ts.blocksize, u.ktfbueblks, u.ktfbuefno from sys.recyclebin$ rb, sys.ts$ ts, sys.x$ktfbue u, sys.file$ fi where ts.ts# = rb.ts# and rb.ts# = fi.ts# and u.ktfbuefno = fi.relfile# and u.ktfbuesegtsn = rb.ts# and u.ktfbuesegfno = rb.file# and u.ktfbuesegbno = rb.block# and ts.bitmapped <> 0 and ts.online$ in (1,4) and ts.contents$ = 0 and bitand(ts.flags, 4503599627370496) <> 4503599627370496 union all select ts.name, fi.file#, u.block#, u.length * ts.blocksize, u.length, u.file# from sys.ts$ ts, sys.uet$ u, sys.file$ fi, sys.recyclebin$ rb where ts.ts# = u.ts# and u.ts# = fi.ts# and u.segfile# = fi.relfile# and u.ts# = rb.ts# and u.segfile# = rb.file# and u.segblock# = rb.block# and ts.bitmapped = 0 union all select ts.name, fi.file#, f.extent_start, (f.extent_length_blocks_2K /(ts.blocksize/2048)) * ts.blocksize, (f.extent_length_blocks_2K / (ts.blocksize/2048)), fi.relfile# from sys.ts$ ts, sys.new_lost_write_extents$ f, sys.file$ fi where ts.ts# = f.extent_datafile_tsid and f.extent_datafile_tsid = fi.ts# and ts.bitmapped <> 0 and ts.online$ in (1,4) and ts.contents$ = 0 and bitand(ts.flags, 4503599627370496) = 4503599627370496
Solution: just purge dba_recyclebin and queries will fly on dba_free_space
purge dba_recyclebin;