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

  • Home
  • SEARCH
  • 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 650617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:04:22+00:00 2026-05-13T22:04:22+00:00

A multitennant database for use by telsales agents, a table contains the prospect leads

  • 0

A multitennant database for use by telsales agents, a table contains the prospect leads to call. One record is displayed to the agent at a time for him to call, after the call the agent updates the record with a coded call outcome taken from the outcome table. In this table some outcomes have a recycle time, after which the record should be displayed to an agent (any agent) to call again. In practice 80% of calls will result in the record being recycled like this. There is also checking to limit the total times called, total number of days to call, and total calls in one day. Agents can also specify to call a record back themselves at a set date and time.

Draft Schema to Illustrate

Prospect table
PK
{contact details}
{XML fields to enable custom fields}
last call outcome
last call datetime
total times called
times called today
record_in_use_flag
(I’m thinking of having the front end just update this table with the prospect info updates, call outcome and agent, then a trigger updates the times called fields/call date and also updates the calls table.)

Calls Table
PK
FK to Prospect PK
call outcome
call datetime
agent called
(Agents may update the prospect record, these changes are not tracked, but a record of the call and outcome is stored)

Outcome Table
outcome code (PK)
recycle time in minutes

Scheduled Callbacks Table
PK
FK to Prospect PK
datetime
agent

My question

What is the most performant way to select the records that should be called next that will scale the best? Ive already decided to store the last call details and some calculated info (times called etc) in the prospect table so a join to the calls table is not necessary.

a)Should each database request for records add the call outcome recycle time to the last call date and then filter for the TOP 1 (think this would be far to slow)

b)Should i create another table with prospect PK, due call datetime for each record in prospect table that needs called again. Could update this by:

1) a separate procedure that say ran every 10 minutes? Outcomes where the recycle time has changed would need recalculated

2) in the trigger on the prospect table that runs once an outcome is updated. Outcomes where the recycle time has changed would need recalculated
(This new table would be updated if the recycle time for an outcome changed)

  • 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-05-13T22:04:22+00:00Added an answer on May 13, 2026 at 10:04 pm

    The problem I’ve faced with this type of situation is making sure that two operators don’t elect to make the same call. So the OUTPUT clause can help.

    You could create a function which works out the next call time, and then use the OUTPUT clause to return the call details to the operator.

    Something like:

    UPDATE c SET NextCallTime = dbo.GetNextCallTime(CallID)
    OUTPUT deleted.* --Which returns the copy of the row before the change is made
    FROM 
    (SELECT TOP 1 * FROM Calls ORDER BY NextCallTime) c
    ;
    

    I don’t like to endorse scalar functions, but it’ll work in this scenario, because you’re only ever calling it a single time. Put comments in the function to make it very clear that it’s never to be called in an ORDER BY clause or a WHERE clause, etc…

    The benefit to using the OUTPUT clause is that it returns that row that is being changed, so it can only be given to a single operator.

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

Sidebar

Related Questions

No related questions found

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.