Support for STRAIGHT_JOIN in Mysql and MariaDB
Fantastic work to all involved! I recently came across a need that was difficult to work around. We had queries taking much longer than expected after a DB version change. In the end, it was discovered that the query optimizer had been changed in the updated DB. I needed to be able to get the original code performing well again which was using Squirrel to build the select statements.
Would you consider supporting the STRAIGHT_JOIN join option in Mysql and MariaDB. It would allow the ability to specify join order where the optimizer gets it wrong. Addition seems simple enough:
Add to select.go:
// Join adds a STRAIGHT_JOIN clause to the query. func (b SelectBuilder) StraightJoin(join string, rest ...interface{}) SelectBuilder { return b.JoinClause("STRAIGHT_JOIN "+join, rest...) }
Would be very helpful.
Thanks!
To avoid an explosion of complexity I've generally avoided dialect-specific syntax. You've already discovered the JoinClause method - this is exactly what its for.