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 8323645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:46:47+00:00 2026-06-08T23:46:47+00:00

I have a function that works off of a view with two case statement.

  • 0

I have a function that works off of a view with two case statement.
The problem is that because of this case statement, it is taking 25+ seconds to run the function. Where as it should only be taking ~3 seconds (comparing to an identical function with a view that doesnt call a case statement.)

The case statement is done within the select.

Interestingly enough(for me), If I changed one of the case statements to something direct ie D.CARS instead of

CASE WHEN D.CAR IS NOT NULL 
THEN D.CAR              
ELSE C.CAR
END AS CAR,

Then it speeds up to ~3 seconds to run the function but shows some off results. So it only seems to take~25 seconds if there is TWO case statements in the select statement.

The views regardless of number of case statements or not take less than 1 second to populate.

Is there a way to speed it up while still getting the correct results?

  • 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-08T23:46:49+00:00Added an answer on June 8, 2026 at 11:46 pm

    Instead of a CASE expression, why not use COALESCE?

    COALESCE(D.CAR, C.CAR) AS CAR
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this jquery function that works, except I need to add something. I
I have a function that renders RGB video frames to a window. This works
I have this jQuery script that works fine: $(select).change(function () { var finalPrice =
I have the following function that works properly in Chrome and Firefox, but not
I have a simple function that works in chrome, but in Internet explorer (9)
I have a popup function in a program that works well, be re-loads the
I have a javascript function, that works fine if it's anonymous but stops working
I have the following Javascript code that works perfectly: $(document).ready(function() { $(#Select1).setDefault(); $(#Select2).setDefault(); $(#Select3).setDefault();
I have the following code that works on Firefox and Chrome $("#adicionarItem").click(function(){ $.ajax({ type:
I have a function that return an array (won't work in IE) with two

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.