- Aug 25, 2004
- 11,151
- 1
- 81
I writing a PHP app where one of the SQL tables has a column (lets call it "file") containing file paths (e.g. 'example/folder1/image1.gif'). Most of my queries would be something similar to:
select file from sometable where file='example/file1.ext';
I'm a beginner when it comes to databases - I know my way around with code, but I don't have much knowledge about the theoretical stuff (like normalization). Anyway, I was thinking the above query would get slow as the table size increased. Someone suggested using a hash value, so I was thinking I'd add a new column (lets call it "hash") and this would have hash values from 0 to 99. The sql query could then be modified to look like this:
select file from sometable where hash=5 and file='example/file1.ext';
My question is, will this help speed up my app, or am I just wasting my time???
Thank you
select file from sometable where file='example/file1.ext';
I'm a beginner when it comes to databases - I know my way around with code, but I don't have much knowledge about the theoretical stuff (like normalization). Anyway, I was thinking the above query would get slow as the table size increased. Someone suggested using a hash value, so I was thinking I'd add a new column (lets call it "hash") and this would have hash values from 0 to 99. The sql query could then be modified to look like this:
select file from sometable where hash=5 and file='example/file1.ext';
My question is, will this help speed up my app, or am I just wasting my time???
Thank you