I keep seeing lots of questions about how to bulkify queries (often in the context of a trigger) based on data from a collection of input objects.
We are all aware of the typical approaches such as the use of building one or more collection(s) of values from the inputs to query against then the use of a Map (perhaps using an Id key, or even Object key as I have suggested here) to make looking up that bulk data efficient when processing the input objects, but I can't seem to find a good "canonical" Q&A explaining the common patterns.
Having one would help reduce the burden on the community by making it easy to mark questions as duplicates but also by giving developers a great resource to find using their favourite search engine.
What's the process for creating one of these? And does anyone have other favourite patterns that this could include?