SQL query execution speed -
is better, in terms of execution speed in sql, have 2 different tables names 'image' , 'video' or 1 table name 'media' , column name 'type'.
will execution speed same 2 querys?
'select * image id=x';
'select * media id=x , type="image"'
it makes little difference. performance, tables should have index (the first image(id)
; second media(id, type)
).
there slight inefficiency media
table, because records larger: type information stored on each row. results in corresponding tables have few more data pages, effect important when start having millions of records.
balancing (potential) advantages of storing content in single table. if have foreign key relationships can either images or video, single mediaid
can be used relationship. if have queries combining 2 (how many "media" user have?), having them in same table advantage. if have other common attributes (such creation time, byte size, format, , on), having them in 1 table provides single point of reference.
in other words, performance difference negligible. data model should based on entity descriptions application.
Comments
Post a Comment