I have an application that is managing inventory for a company that has multiple locations. Items are being inserted into an inventory table roughly every 5-6 seconds from three locations.
At the same time, this company is packing inventory in boxes in order to fulfill orders. I have a table setup for this in which inserts are made for an inventory id and a box id (tied to a purchase order table) to show when an item has been packed and is no longer in inventory. Roughly 6000 items are being added per day into inventory as well as being shipped out of inventory.
Before an item is being shipped - I have to first check the inventory table to make sure the item exists in inventory and also need to check the shipping table to make sure the item hasn't been shipped. I'm also checking these tables on the sales side to verify when an order has been completed. These two tables are being hit every few seconds both with reads and writes.
I'm running into some performance issues as the size of my table is growing. I've been researching the problem and have a couple of ideas on how to fix this - but wanted to check here first to see if I'm on the right track.
1. Indexing this table in order to get better performance during the lookups. From what I've read, this will improve the select queries - but will slow down the inserts since the table will be re-indexed after each insert. Since I'm inserting into these tables every couple of seconds - I'm wondering if having indexes on these tables might degrade performance instead of improving it.
2. The queries are being performed via my application. Ie, a query checks to make sure the item is active in inventory - results are returned to the application and either an error is thrown or an insert statement is re-submitted to the SQL server. By moving this into a stored procedure - I'll remove the network traffic associated with going back and forth between the application server and the sql server.
3. I've read a little about partioning and it sounds like this might help (ie, partioning on each of the location id's) - but I have not gone into it enough to really know enough about it.
Hopefully my question was clear. Any advice or suggestions are appreciated.
May 17, 2009 12:11 AM
October 23, 2013 2:27 PM