Often, rice is in salt dispensers to prevent moisture from making the salt become clumpy and possibly get stuck in a shaker.
What else can be used to get the same effect?
I don't know if the mechanism (for either rice or anything else) is actually a desiccant or mechanical action for breaking the clumps after they form, but I have seen movie theaters (where they are obviously in abundant supply) using popcorn kernels for this purpose.
You can use coffee beans instead of rice grains, it works the same but they are bigger.
And no, it won't pick up the coffee flavor. It's a very common thing in Argentinean restaurants. I've never felt, after using salt from the table, that my food tastes like coffee.
You can use dried parsley leaves to prevent moisture. Fill up 1/4 of the shaker and then put in the salt. You can also put in toothpicks, which will have the same effect. I prefer broken ones, but they have to be cleanly broken. One last method I know of is to use dry beans. I've done it with black beans, but I believe other types will work too.
Growing up my Mom had a salt shaker that came with a glass "cap" kind of that had some kind of purple granules in it. Have no idea what they are but it works. I have them now but don't use them. The salt is still dry as a bone.
I've used a couple of dried beans (pinto, black, white) with good results. They're hygroscopic, just like uncooked rice. I get no clumps.
I doubt those will fall through your shaker! :)
We use orzo. It's a kind of pasta which is shaped like a slightly flattened grain of rice. It is a little longer than long-grain rice, and more importantly it is notably wider than a grain of rice, so it should not come out of your salt shaker accidentally. It is cheap, lasts forever, and available in multi-color which can be decorative if you have a clear salt shaker.
I suggest getting large-grain rice that is big enough not to fall through the holes in the shaker. I did a Google search for "large grain rice" and found many entries. This may be slightly more expensive, but purchasing a bag of it should last a long time.
Now included with many medication containers of tablets that might attract moisture is a small hard silica plastic like barrel about 1/2 inch (~1cm) long, in the container. It is a desiccant and is safe and does not breakdown. This could be used in the salt container.
My first salt grinder, a Peugeot, clogged up just a few weeks after purchase. It still had the salt that came with the grinder.
I placed it in a narrow cup-like plastic container, not much wider than the grinder itself and inside the container I placed a couple of unopened sachets of silica gel. It seems to have cleared out the clogging to a large extent.
I suppose you could also fill such a narrow container with some rice and store the mill in it. The rice/silica gel gets to do its work effectively because it's right next to the grinder mechanism and there's no chance of getting any in your food.
Salt absorbs moisture so at humid times this problem can occur. Alternatives to rice could be millet or quinoa or other grains large enough to not fall through the holes for the salt.
A study on water absorption characteristics of the selected cereal grains was conducted. It was found that well dried maize, sorghum and millet grains take about 96, 48 and 24 h, respectively, to reach their water absorption capacities (water absorption saturations). Millet had the highest rate of water absorption as well as the total water absorbed. The rate of water absorption in sorghum was higher than in maize but maize grains imbibed more water than sorghum.
Sometimes you get little packages of silica gel when you get some new electrical
toy tool, I do believe this can be used to keep salt dry. Haven't tried it myself though.
I usually use wild rice because of the longer grain size. I have also used uncooked spaghetti noodles when out of rice. Just break a couple of noodles into pieces 1/2 to 1 inch on size and add to salt shaker.
This question has an answer that's totally different, but I find it works quite well: place salt and other clumping spices in a sealed box or bag with a cheap calcium chloride dehumidifier packed/box. You can't use silica, because it reaches equilibrium and stops doing anything, while calcium chloride will work for a while even after it has totally liquified. The effect is strong enough that it will restore a salt shaker that has already clumped. The obvious disadvantage is that it's annoying to store your salt in a sealed container, but you could probably get away with keeping the salt in there two days out of each week.