Crush dried shrimp with a mortar and pestle until reduced to featherlike strands, then transfer to a small bowl and set aside. Finely crush chile with the mortar and pestle and set aside. Put dried shrimp paste and 3 tbsp. water into a small bowl, stir until completely dissolved, and set aside.
Heat oil in a wok or a large heavy-bottomed skillet over medium heat. Add onions and fry, stirring constantly with a slotted spoon, until golden and crisp, about 5 minutes. Transfer onions with slotted spoon to paper towels to drain. Fry ginger in the hot oil, stirring constantly, until golden and crisp, about 1 minute, then transfer to paper towels to drain. Fry garlic in the hot oil, stirring constantly, until golden and crisp, about 1 minute, then transfer to paper towels to drain. Set onions, ginger, and garlic aside separately to cool completely.
Fry crushed dried shrimp, chiles, and turmeric together in the hot oil over medium heat, stirring often, until shrimp are deep golden and crisp, about 5 minutes. Transfer shrimp mixture to a bowl. Add diluted dried shrimp paste to wok, reduce heat to medium-low, and cook, stirring constantly, until thick, about 2 minutes. Return crushed dried shrimp mixture to wok, add sugar, and stir well. Transfer to a bowl and set aside to cool completely. Add fried onions, ginger, and garlic and mix well. Relish keeps, tightly covered, in the refrigerator for up to 1 month.