Start with in Oracle. How to optimize connect by prior

start with in Oracle. How to optimize connect by prior?
an address table has a total of 8-level addresses. Pass in the address id, to query all the superior addresses. The code is

.
select address_id    addressId,
           address_name  addressName,
           address_level addressLevel
          from rm_address t
             start with t.address_id = -sharpvillageId-sharp
            connect by t.address_id = PRIOR t.PARENT_ADDRESS_ID
             order by address_level
             
             

now the query is very slow, how to optimize it? -sharp-sharp title text-sharp-sharp

Jan.08,2022

for this kind of problem, it is recommended to talk about the amount of data in the table, the index, as well as the current execution time and execution plan of the sql statement, so as to facilitate everyone to analyze the problem.

according to the sql statement you wrote, please first check whether there is an index on the t.address_id field.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e42602-6634d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e42602-6634d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?