What are pros and cons of txindex option? I am reading "Mastering Bitcoin" written by Andreas and I found this explanation about "txindex option"


  Transaction Database Index and txindex Option
  
  By default, Bitcoin Core builds a database containing only the
  transactions related to the user’s wallet. If you want to be able to
  access any transaction with commands like gettransaction, you need to
  configure Bitcoin Core to build a complete transaction index, which
  can be achieved with the txindex option. Set txindex=1 in the Bitcoin
  Core configuration file


I am not sure what situations should I enable the option. In my understanding, I can set txindex=0 if I use bitcoind as just a transmission tool of Bitcoin so that I can save data and time to sync the blockchain data. Otherwise, if I intend to make a blockexplore site like Blockchain.info, I need to set txindex=1.

Is my understanding of this correct?
If you're using Bitcoin Core just for your own personal use, you probably don't need the -txindex=1 option. But, if you're using Bitcoin core for development or blockchain analysis of some sort, you will need to set -txindex=1 to be able to get transactions data for any transaction in the blockchain. 

The tradeoff is just that keeping an index is slightly slower, but allows you to do things like:

bitcoin-cli getrawtransaction aec2729f5e46750b310b6feadcf853098aa86df74f93322a701c29cd68b22568 


(where aec2729f5e46750b310b6feadcf853098aa86df74f93322a701c29cd68b22568 is the ID of a transaction that does not affect your wallet at all).

Also, if you have been running your client for a while but haven't had txindex=1 set, then it might take a few hours to build the index. If you want to rebuild, launch with the -reindex option.