<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/gitlab/gitlab-ce.git/doc/development/database_helpers.md, branch docs-sethgitlab-featureflags</title>
<subtitle>gitlab.com: gitlab-org/gitlab-ce.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/gitlab/gitlab-ce.git/'/>
<entry>
<title>Add Gitlab::Database::Subquery.self_join to delete_all with limit</title>
<updated>2018-09-20T14:27:09+00:00</updated>
<author>
<name>Toon Claes</name>
<email>toon@gitlab.com</email>
</author>
<published>2018-09-18T15:32:21+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/gitlab/gitlab-ce.git/commit/?id=ce830d3c60fbf445c67fb923f03678ad2333eba5'/>
<id>ce830d3c60fbf445c67fb923f03678ad2333eba5</id>
<content type='text'>
`delete_all` doesn't support limit, so you'd need to subquery
that. And instead of subquerying with `where(id: query)`, it's better
to use an `INNER JOIN`. This method also works with MySQL, while
subquerying doesn't (without another layer of subquerying)

Reference:
https://stackoverflow.com/questions/17892762/mysql-this-version-of-mysql-doesnt-yet-support-limit-in-all-any-some-subqu/17892886#17892886
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`delete_all` doesn't support limit, so you'd need to subquery
that. And instead of subquerying with `where(id: query)`, it's better
to use an `INNER JOIN`. This method also works with MySQL, while
subquerying doesn't (without another layer of subquerying)

Reference:
https://stackoverflow.com/questions/17892762/mysql-this-version-of-mysql-doesnt-yet-support-limit-in-all-any-some-subqu/17892886#17892886
</pre>
</div>
</content>
</entry>
</feed>
