Обсуждение: Views, indexes and date stamps

Поиск
Список
Период
Сортировка

Views, indexes and date stamps

От
Todd Lewis
Дата:
I've recently broken down one of my larger tables into 2 tables for
performance reasons. One table contains current information and the
second table contains older historical information. I've created a view
that unions the two tables together. I created the view with a Select *
from table_1 union select * from table_2. I have the same columns
indexed in each table. Does a query using the view take advantage of the
indexes on a table? I'm currently using 7.4.7.

Also one of the queries I run repeatedly uses one indexed column and a
date stamp column. I retrieve the max date stamp for a particular type
of transaction so that I can retrieve the items last activity. Is there
any benefit from indexing a date stamp column? These tables combined
have about 13 million records. It grows about 1 million records a month.
Will I get better performance with a second view that only contains the
columns that this query needs?