Is there any difference between speed of fetching data if dynamic rows is moved towards end.
example : int , int , int , text is better than int int text int ?
my lead has informed me about this fact , how ever no such information is getting from internet ? please help ?
This is due to data alignment.
INTtakes 4 bytes, so 32-bit (equivalent to 4 bytes) processors will work with data in 4 byte sequences. Being able to pull off the data in an order that best suits the processor will lead to faster results and better performance.Reference: http://en.wikipedia.org/wiki/Data_structure_alignment
Now, this is a problem often found in transferring data over a communication channel (because certain compilers will typically optimize your data structure by adding a reserved byte to 4-byte align certain members). However, MySQL also takes 4-byte alignment into account with
NDBCLUSTERengines. This means that by placing yourTEXTstructure in between theINTvalues, you force more data retrieval than necessary.Thus:
INTINTINTINTTEXTwill process faster thanINTINTTEXTINTINTas the processor can retrieve 16-bytes (the fourINT) immediately without worrying about the size ofTEXT.For more details, see the MySQL documentation:
http://dev.mysql.com/doc/refman/5.5/en/storage-requirements.html