[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Design for SQL Server data solution to handle constant inserts/updates/deletes and also constant searching

Posted on 2016-09-09
4
Medium Priority
?
41 Views
Last Modified: 2016-10-29
Hi,

We are developing a database solution that will run on SQL Server 2014/2016 and wanted to see if any experts could pass comment or suggest a better/different approach.

The solution will involve a collection of tables (we'll call these the 'data' tables) that will be constantly updated by an external multi-threaded application running on a collection of external servers, probably around 20 data tables.  The data in these tables is updated using SQL MERGE and performs well already.  

The part we need to design is regularly (minimum of every minute) moving that data into the search tables which will be constantly searched on from a public website.

Our plan is to create a view/query to perform some basic calculations to create a subset of relevant data from each of the data tables, and use the output of that query to push the data into our search tables every minute.  We plan to use a stored procedure that will run every minute for each data table. Each stored procedure will select the relevant data from the data table and use SQL MERGE to insert/update/delete the records into the search tables.

We then plan to use the (NOLOCK) hint when querying the search tables in case any locking slows down the searches.  We'll probably create a view that UNIONS all the search tables to enable us to search across them.

This is our basic plan, along with optimizing the indexes to try and find a balance between optimizing the searches without degrading the time it takes to perform each merge.

Key points to consider are...

* There are around 20 'data' tables
* A subset of the data in each 'data' table is (after some basic calculations are used select the relevant subset) merged into the search tables
* Queries on search tables need to be as fast as possible with no delays (due to locking etc)
* Queries on search tables CAN allow for dirty reads
* Total amount of records in the search tables will be around 500,000 to 1m

Think that's the basics - please ask if you need any more information, but would love to hear any potential issues you see with our plan, or a better suggestion on how to approach this to put the most efficient solution in place.

Thank you :)
0
Comment
Question by:cp 30
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 66

Accepted Solution

by:
Jim Horn earned 1000 total points
ID: 41791307
<knee-jerk one minute short attention span answer>

Sounds like SP's that fire every x minutes to drop a table (20 tables..), create the table per your specs, then slap a COLUMNSTORE index on it to optimize SELECT statements on it.

You'll want to time this as it might not be conducive to an every-minute update scenario, and if it's not then we're talking a MERGE statement without the columnstore index.
0
 

Author Comment

by:cp 30
ID: 41792534
Hi Jim,

Thanks for the suggestion.  Do you know how the  queries on the search tables be handled if the tables were in the process of being dropped and recreated?

Thanks
0
 
LVL 70

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 1000 total points
ID: 41795059
Use a separate db for the search data.  Set RCSI on for that db.

You would only need the data that was modified since the previous minute.  Add a column with mod datetime and index it appropriately.  Then simply SELECT from the tables where the mod datetime > the time of the previous pull.

The data in these tables is updated using SQL MERGE and performs well already.  
Interesting ... typically MERGE does not perform as well as a separate UPDATE and INSERT (so-called "UPSERT").
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question