I am designing an SQL database (accessed via PHP/MySQL) and have questions about designing the database in a way that helps the website run relatively quickly. My precise question pertains to speed when querying a table with many columns where one column is of type text. I am wondering, if
- this table will be frequently queried,
- the queries only about 50% of the time will include the text column,
- and I specify the columns names so the text column is not returned in those 50% of queries,
will the presence of the text column in the table affect the query speed? As a follow-up, do text columns generally slow down database queries?
Any other general tips on database design to help boost query speed are appreciated, as are any suggestions for books or other references on this topic. Thanks!
afaik there is no difference if you add a text column to a table, as long as you do not use it in the where clause.
if you use it in the where clause it’s definately good to have an index on it. Avoid comparsions with like, as they are slower.