I have a statement trigger that executes a function after some rows are updated. With the transition table of the trigger (joined with some other tables) I need to create a temporary table, which I will use to query later.
The thing is, the query on this temp table is pretty fast but when the number of rows increase it gets slower. So I was trying to add an index. My question is how can I measure the impact of the index creation? If the number of rows is not high, the index is not being used, so I would need to know if the index creation is expensive.