Just like in a brick–and–mortar store, items that are in shopping baskets are removed from your inventory. It's fairly common, however, for customers to add products to their baskets but never complete the purchase. For example: a customer visits your store, adds products to their basket, then changes their minds and closes their browser. The products in that basket can't be purchased by anyone else. If enough products accumulate in abandoned baskets it can appear that your store has run out of those items.
You can prevent this from happening by:
Setting the > Store Settings > Edit Store > Store Details tab > Settings section > Basket Timeout (Minutes) field.
The Basket Timeout sets an "idle time". When a customer hasn't purchased or changed the contents of their basket for that time, the basket is automatically expired. The items in their basket are still removed from your inventory, but an expired basket can't be used by a customer and is ready to be deleted.
But see also:
Clicking this button automatically starts a script which optimizes the database tables and improves performance. In general it should be done once a week, but if you have a very active store, you may want to click on this link more often. If you encounter any kind of server or database error while packing data files, please contact support.