Search code examples
mysqlviewcarttemp-tables

What is the difference between views and temporary tables in mysql? which is better?


What is the difference between views and temporary tables in mysql? which is better?


Solution

  • Performance between Views and Temporary table is straight forward.

    They depend on their definitions :

    Temporary tables are just the tables in tempdb. Views are stored queries for existing data in existing tables.

    Temporary table needs to be populated first with data, and population is the main preformance-concerned issue.

    So the data in views already exists and so views are faster than temporary table.

    If any issue or query please let me know.