i use dynamic columns without problem, it don't have a good future cause it's only a lot of function to encode/decode data, in other words, the future is the today present + some new features to easly handle data or optimize space or optimize cpu/memory usemake sure you are using a good encode system, dynamic columns is a encode system, like json, like php encode/decode, like base64 encode/decode, but with some pros/conswhen using a encode system, check if cpu and data size used is ok to your problem, for example a "1024" integer, can be saved with a 4 bytes string, or a 2 bytes integer, if you have 1.000.000 rows, you can save 2.000.000 bytes (allowing a better cpu/memory use), think about encoding a 64bits integer with string, and with a bigint column, use it with 1M rows....the problem of encoding data, isn't only encode, the problem is how database search this encoded valueswe don't have index over functions and optimizer don't rewrites virtual column and functions (yet), that's probably something that document based databases do very well something like ~ search inside documents---some ideas....1) specific index ideawe could have a dynamic columns index, instead of a btree index, something like full text indexes do...2) general ideaif we could have a "index( some_function(field) )", and could optimize "some_function(field) ='xxxx'" using the index, this could solve many problems of dynamic column and encoding data at database, with more complexity we could include some index optimizations to functions and "rewrite" the queriesexamples....2.1) the optimize should be inteligent to rewrite virtual columns using the same functionwe have a virtual_column_indexed = substring(column,1,20), let's execute:WHERE substring(column,1,20)='1234', <- full table scan + execute a function each row (is substring cpu/memory intensive?)optimizer should rewrite toWHERE virtual_column_indexed = '1234' <- using index without executing the substring function each row (less cpu/memory used)or if cpu time expent with substring function is very high and we have a virtual_column_not_index=substring(column,1,20), optimizer could rewrite toWHERE virtual_column_not_indexed = '1234' <- ful table scan - without executing SUBSTRING function each row2.2) the functions should be indexed (only deterministic functions)examplewhen we create a index over a function, we don`t need a new column, think about myisam storage... we don't need data at MYD file, we only need data at MYI fileindex functions ~= "indexed hidden virtual columns"when we executeWHERE substring(column,1,20)='1234' <- full table scan + cpu/memory use of substring function for each rowoptimizer should rewrite toWHERE internal_hidden_column = '1234' <- internal index2.3) the functions could explain about others rewrite tipsexample...when we executeWHERE substring(any_column,1,20)='1234'we can rewrite it with some understand of substring function (value,start,end)we know that it return the same string, but starting at start position, and with a possible length of end-start, in other words, if we want to 'optimize' (or not) this function, we could rewrite toWHERE any_column LIKE '1234%' AND <-- (1) possible a column using index?length(any_column)<=20 AND <-- (2) length is 'faster' than compare stringssubstring(any_column,1,20)='1234' <-- (3) include the function to execute the last check if (1) and (2) are truecheck if we have many negative cases to (3), we can optimize some searchs with (1) and (2)if any_column is a index column, we have a optimization at LIKE operator (really fast)but if we have many positive cases to (1,2) we just include more cpu time to execute two functions, in this case only substring could work faster (cause it use less cpu than 3 functions)the same forWHERE substring(any_column,5,20)='1234'could be rewrite toWHERE any_column LIKE '_____1234%' AND length(any_column)<=20 AND substring(any_column,5,20)='1234'2.4)if we have a very cpu intensive function, the SELECT part could be optimized tooSELECT EXPENSIVE_FUNCTION()FROM tableWHERE single wheretoday we can optimize it with virtual columns...virtaul column = EXPENSIVE_FUNCTION()and instead of SELECT ENPENSIVE_FUNCTION we write SELECT virtual_columnbut since optimizer is inteligent, why it can't rewrite the query it self?----check that's not a limit of dynamic columns, only a limit of optimizer/index and rewrite function to search faster when using functionsi don't know if we could include others ideas to tune/optimize database
_______________________________________________
Mailing list: https://launchpad.net/~maria-discuss
Post to : maria-discuss@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-discuss
More help : https://help.launchpad.net/ListHelp