Optimizing sql query for 1:N relationship between book and genres/authors