In the old days, even a few grains caused problems, and around heavy oil there was always lots of sand. In those times, the emphasis was on sand prevention - trying to keep it out of the wellbore. Gradually, technology and ideas changed and now sand is "produced", i.e. pumped out of the well along with the oil, resulting in increased oil production.
Over the years, sand has been a major challenge and our people have responded with a vast array of techniques and technologies. If sand fouled a pump, the workover crew had to pull all the tubing to reach the pump and then replace it. Chances were it would plug again in a few days or even hours. Sometimes the wellbore itself would become partially filled with sand and a bailer, run on a sandline was used to bite into the sand and remove it one bailer full at a time - a long laborious process.
Techniques developed to flush the sand out of the well bore initially just used the produced salt water as the flushing fluid. Later, a product called heavy gas oil (HGO) became popular. Today a stable foam is being used in one technique.
Progressive cavity pumps (PCPs) have made sand easier to produce and led to those who now say, "sand is our friend". These techniques of sand production have spread out of our heavy oil fields to the rest of the world. A certain amount of sand tolerance has led to dramatic increases in oil production in fields as far flung as the North Sea and Mexico.
Below is a diagram of an approach in "the old days" when sand was strictly an enemy. Sand was washed up the tubing while fluid was pumped down the casing-tubing in this once common sand removal technique.