Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7845519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:15:04+00:00 2026-06-02T17:15:04+00:00

I have a logging table that I need to run close to real time

  • 0

I have a logging table that I need to run close to real time reports on. The primary key is a guid that is inserted non sequentially. When other indexes are added to aid in reporting speeds I am seeing timeouts on inserts. I plan on creating a duplicate table with the reporting indexes and leaving only the clustered index with a fill factor of 75% on the in the logging table.

I feel like using replication would be overkill for only one table. So my question is how should I accomplish this? Should I schedule a sql agent job?

Any help would be great! Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T17:15:07+00:00Added an answer on June 2, 2026 at 5:15 pm

    You have a lot of options available to you. To solve your immediate problem, I’d make sure that the logging table has a sequential ID on it and only copy across new data to the well indexed reporting table. You can then run a NON-LOCKING proc to get just the max value for the corresponding column in the reporting and get anything bigger from the logging table.

    DECLARE @MaxValue uniqueidentifier
    
    SELECT @MaxValue = MAX(LogID) FROM LogTable
    
    INSERT INTO 
       ReportingTable
       (...)
    SELECT
       ...
    FROM
       LogTable WITH NOLOCK
    WHERE
       LogID > @MaxValue
    

    NB: See this for NOLOCK debate. Only use it if your log table is BIG and BUSY, but your scenario is an example of where it makes sense.

    I’m not sure what generates your GUID, but if it is SQL server, then making the column default to NEWSEQUENTIALID() means it’s not entirely random, but it is sequential. If you are getting the GUID from somewhere else, then consider putting a bigint IDENTITY(1,1) column to make sure your clustered index is not badly fragmented. A fragmented clustered index is bad as your other indexes use it for lookups so no matter how nice they are, they’ll still run slower than the primary.

    Then you can structure your reporting table any way you like with a clustered index on the GUID and only and use the max value in your well indexed table to only insert the new data you don’t already have. You can also run re-index on that table to ensure it’s as fast as possible.

    More information..

    If you expect your system to grow a lot, then you should look at some other reporting patterns to denormalise or simplify the data as you dump it in the reporting tables.

    Take a look at the star pattern or you can just denormalise daily or weekly stats into a seperate table like the following:

    Date, TimespentTotal, TimespentAvg, UserFact2Count....
    

    then you can run a non-locking stored procedure to get a day’s stats at a time. I’d also recommend that days stats be loaded based on what you don’t have in the reporting database incase the agent job that runs it fails, it will take care of backlog when it runs next. Obviously these patterns are a lot more work and the wrong choice can be bad so only make this choice if you need to and know what’s expected of your reporting.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a logging table on the master server that is inserted into very
I have a logging table that stores the user id, date/time, table name, record
I use SQL Server 2005. I have a simple logging table that my web
I have an application that records activity in a table (Oracle 10g). The logging
I'm writing a simple logging service in DynamoDB. I have a logs table that
We have a project where data is written to a logging table. Now, when
I have a logging class that stores entries in a datatable dt. I then
I have a logging project , i need to know how to build a
I have a static logging function that uses StringBuilder to concatenate a bunch of
For a user logging table I have in a SQL database, I track the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.