MySQL Forums
Forum List  »  Performance

Split table
Posted by: Carlo Martinez
Date: December 26, 2011 04:28AM

Hi all,
I have to store the filesize of each file on a users directory, for example:

C:\Users\marc\file1.txt 2500
C:\Users\marc\file2.txt 3270

and the most executed query are:
SELECT filesize FROM files WHERE filename = 'C:\Users\marc\file1.txt'
or
SELECT filesize FROM files WHERE filename LIKE 'C:\Users\marc\file%'

Index on filename field of course.
filename UNIQUE

Now I'm thinking to split the user part of the filename on a separate table:

Table Users:
Id, Username

Table Files:
UserId, Filename, Filesize

So the query become:
SELECT filesize FROM files WHERE filename = 'file1.txt' AND UserId = 'xx'
Index on filename and UserId
filename no UNIQUE

Any suggestion about perfromance gain/loss of this change ?

Table have about 1,5M rows (800 users)

Thanks
Carip

Options: ReplyQuote


Subject
Views
Written By
Posted
Split table
4402
December 26, 2011 04:28AM
913
December 27, 2011 10:00AM
1103
December 29, 2011 04:01AM
941
December 30, 2011 12:30AM
1085
December 30, 2011 03:23AM
1051
December 31, 2011 09:19AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.