Gateway Timeout Error (Linked with)

I am getting Gateway Timeout Error while accessing “Links” Menu item with Sales Order Doctype. Is anyone assist me the reason why it is giving this error, i even increased read_timeout from 120 to 600 in nginx config. but still getting same error.
@pdvyas @anand any comments/suggestions on this Error.

Linked with is not performance optimized.

Please don’t tag users with @ unless you are replying.

Thanks Rushabh
Let me figure out an optimize way if i will be able to complete quickly then i will contribute in code.