简体   繁体   中英

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?

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.

根据您的有限输入,唯一的答案是:确保正在使用索引

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM