PGWinFunc: Optimizing Window Aggregate Functions in PostgreSQL and its application for trajectory data