samedi 20 décembre 2014

MySQL column type to boost performance


I'll have a table where:


userid (link to user's id in users table) foldername (a varchar, max. 260 char) entry (varchar, max. 1024) data (varchar, max. 20kb)


Single user will have several foldername and entries. The point is, queries will never ever search anything inside entry or data. Queries ONLY will be like "select * from data where userid = 1 and foldername = 'first'" That's it.


So I thought about two options: a) Instead of entry and data columns, storing them inside HDD and only storing filename in DB, so when query returns, PHP app. will read filename, then read the file and send it to user in HTTP response.


b) Store them in DB as I said above


But I'll never run queries on them, so no sorting/indexing will be needed and no full text search will run ever.


What's the best possible optimization here? How can I define a column as a "not-really-a-database-entry" type in MySQL? or file is better?





Aucun commentaire:

Enregistrer un commentaire