fixed db select performance (using "analyze");
slight speedup of getOnOffEventsAtDay;