if we have table such:
create table x(
id int primary key,
something_else_1 int,
something_else_2 int,
something_else_3 int,
char_data text, -- or varchar(1000)
);
this table will be queried on all fields except char_data.
most queries will be similar to:
select id, something_else_1
from x
where something_else_2 = 2 and something_else_3 = 5;
question is – if we have indexes etc,
what configuration will be better – text or varchar.
Just one final note –
I know I can separate this into two tables, buy separation in this case will be not the best idea, since all fields except the blob’s will be something like unique index or similar.
Then data type of
char_datahas no influence over performance. Only if you selectchar_datait’ll consume more bandwidth. Nothing else.Its not a problem. Because you are not using in your sql.
SELECT *will become slow butSELECT id, something_else_1will not make it slow.WHERE id=2 and something_else_2=1has no effect, butWHERE char_data like '%charsequence%'. As long as you are not searching your table withchar_datayou are safe.Besides if you still want to search by
char_data, you should enable full text search.Note: Full text search is only supported in MyISAM table engine.