MySQL性能:DATE与TINYINT

Normally my table contains a DATE column, and when it's permanently empty is 0000-00-00. Is it better to add an additional column TINYINT just to track if the row is permanently active, so my searching performance will be better? Or should I keep only the DATE column?

SELECT columns FROM table_name WHERE date_is != '0000-00-00'

versus

SELECT columns FROM table_name WHERE col_emplty != '1'

TinyInt should search faster, shouldn't it?

If you want you can set default value for date column as null. So, you just have to check if data is IS NOT NULL, as adding an extra column just to see if the next column has a proper date format, doesn't make sense.

Adding a new field or allowing NULL to a column will solve your problem but both are not a good practice.

If 99% of time you are going to select data on the basis of date(can be default date on any date) or going to update this date field what you can do here is to create a int column instead of date type and keep the value as yyyymmdd(eg: instead of keeping '2015-04-19'(date) keep data as 20150419 (10000*year + 100*month + date) and compare the date value), as this is an int column both searching and updating table will be fast.