Is commit() operation delay is possible due to indexing/vaccuming of database

I am using postgres 8.1 version with read commited isolation level. I am getting a problem where vaccuming/indexing of database is running and at the same time update query is invoked and after that commit() for database query is run. Here commit() operation is delayed and seems success i.e. 0 is returned even before completion of commit() operation, commit() get completed after around 1 minute of returning success or 0.
DBI->Do is used for database operations.
Is commit() operation delay possible due to indexing/vaccuming of database and can 0 be returned as result even before completion of commit() operation in case commit() is delayed?