Jack
Jack

Reputation: 10047

SQL: Query on View - slow execution

Sql newbie here. If you run a query that join two tables and one view. If the view is composed of three tables. Does it slow down the query? Is there anyway to speed it up?

Upvotes: 0

Views: 458

Answers (2)

KM.
KM.

Reputation: 103717

based on your limited input, the only answer is: make sure an index is being used

Upvotes: 0

Andomar
Andomar

Reputation: 238296

A view is not more expensive than writing out the SQL, and sometimes even faster. The database knows about the view, and can cache its execution plan.

But querying on two tables is slower than querying on five tables, whether the three additional tables are in a view or not.

Upvotes: 1

Related Questions