So if you had a model Activity, and you wanted to get the names of some of them, the slower/higher memory approach would be something like:
Activity.where("id < 100").map(&:name)
This pulls results from the database, instantiates each as Activity objects, then iterates through each to get its name. You can see in the logs that it grabs the entire object:
Activity Load (133.7ms) SELECT "activities".* FROM "activities" WHERE (id < 100)
.pluck instead grabs just the field you're looking for without instantiating the entire object. So the better way to grab the list of activity names would be like:
Activity.where("id < 100").pluck(:name)
And you can see from the logs that it makes a more narrow query:
(3.8ms) SELECT "activities"."name" FROM "activities" WHERE (id < 100)