Help/Assist Jarv on optimizing query using cache arrays to eliminate multiple connection in every loops. Also discuss how to optimize database by setting short lenght datatypes and how to implement it.