Is that the process will go through all the blocks and find the block which contains the txid or there's an index table for all transactions?
This is not prescribed in the Bitcoin network protocols, of course. So each software developer is free to make their own choices.
Personally I think only the most inexperienced and naive developer would choose to read and re-read half a terabyte of data every time they need to retrieve a few bytes of data for a transaction. An index of any type is the obvious approach. There are numerous libraries and tools for this purpose.