Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • This is a bad practice because if you have 1000 events, mysql will probably do 1000 subqueries to the bookings, one for each event. There is no guarantee that the optimization will work and rewrite this to be efficient. Subqueries are not advisable. Commented Jan 10, 2014 at 22:28
  • 1
    @saamorim . . . A correlated subquery may be the most efficient way of executing this query, especially when there is an index on bookings(event_id). If you have performance comparisons that suggest otherwise, I would be interested in hearing about it. Commented Jan 10, 2014 at 22:29
  • This should be fine - check the plans. Commented Jan 10, 2014 at 22:52