Firbase performance

My fhirbasey transactions are getting slower . I have around 2.8 million records in my observation table and i am trying to update 10 records out of 2.8 million using transaction . Its taking around 3-4 minutes and its affecting my ui performance also. Can any one help me to solve this. I even tried to delete some of my records, even my deletes also is slower.

Can you trace what exact sql statements are executed (turn on logging on pg side). Pretty sure - some index is missed.