How to get taxonomy tree ids without running expensive loops

How to get taxonomy tree ids without running expensive loops