A database can be optimized by various means:
indexes
memory
SSD
Alternatively processes can run in the background to avoid timeouts.
Comment on This Data Unit