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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:57:19+00:00 2026-05-15T15:57:19+00:00

Will Mssql be even fast when I query on a view opposed to one

  • 0

Will Mssql be even fast when I query on a view opposed to one query?

example

When I have this view:

create view ViewInvoicesWithCustomersName
Select * from Invoices left join Customer on Customer.ID=Invoices.CustomerID

What will be faster or will it be even fast?

a) select * from ViewInvoicesWithCustomersName where customerName="Bart"
b) select * from Invoices left join Customer on Customer.ID=Invoices.CustomerID
   where customername="Bart"
  • 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-15T15:57:20+00:00Added an answer on May 15, 2026 at 3:57 pm

    Whilst in your simple example things will be the same some caution is necessary with using nested views.

    I worked on a system where queries were timing out after 30 seconds built on about 6 levels of nested views and managed to speed these up by a factor of about 100 by rewriting the queries against the base tables.

    A simple example of the type of issue that can arise is below.

    CREATE VIEW MaxTypes
    AS
    SELECT
      [number],
      MAX(type) AS MaxType
      FROM [master].[dbo].[spt_values]
    GROUP BY [number]
    
    GO
    
    CREATE VIEW MinTypes
    AS
    SELECT
      [number],
      MIN(type) AS MinType
      FROM [master].[dbo].[spt_values]
    GROUP BY [number]
    
    GO
    SET STATISTICS IO ON
    
    SELECT     MaxTypes.number, MinTypes.MinType, MaxTypes.MaxType
    FROM         MinTypes INNER JOIN
                          MaxTypes ON MinTypes.number = MaxTypes.number
    ORDER BY MaxTypes.number
    
    /*
    Gives
    
    Table 'spt_values'. Scan count 2, logical reads 16, physical reads 0, 
    read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    */
    GO
    
    SELECT 
      [number],
      MAX(type) AS MaxType,
      MIN(type) AS MinType
      FROM [master].[dbo].[spt_values]
    GROUP BY [number]
    ORDER BY  [number]
    
    /*
    Gives
    
    Table 'spt_values'. Scan count 1, logical reads 8, physical reads 0, 
    read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    */
    

    enter image description here

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

Sidebar

Related Questions

What MySQL query will do a text search and replace in one particular field
I have a MySQL table that will only have one row. What should my
Will limiting a query to one result record, improve performance in a large(ish) MySQL
I've got a sproc (MSSQL 2k5) that will take a variable for a LIKE
It seems like I will be needing transaction with MySQL and I have no
Using standard mysql functions is there a way to write a query that will
When upgrading MySQL, I first create a backup of the database. Then I will
Looking for a tool that will automatically create a graphical representation of a MySQL
Ideally something that will work with Oracle, MS SQL Server, MySQL and Posgress.
I'm making a simple tool that will get a string of MySQL commands and

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.