回復 #8 xfuture 的帖子
"Indexing does not help in while the table is small..."
not only that, index doesn't even help unless u no what u ar doing, indexes are just pointers that re-order the records, since we don't no what queries will be performed, we cannot determine which index will benefit, choosing wrong index will make bad ordering and cause slower performance, thus indexes should not be implemented until u no queries actually bias towards certain tuple, but that may not always happen, often, it will be pretty random and that case, indexes will most likely not help.
"Look at the data provided by tatacat, it's a receipt table..."
apparently, in database, we don't usually consider receipt table like the one provided by tatacat as a large table, because no matter how many records are in there, it's still O(n) to achieve any record, table is a small table
well, it doesn't really matter, the difference isn't big, but the general point is that indexes should not be used when it's not required, u can see that database tables in workplace are usually created without indexes, and they add indexes to certain tables when queries are slow
"we've solve a lot problems of slow queries with adding in indexing..."
well, a slow query kinda implies that index will help, of coz it gives u improvement, but tatacat's query was never slow (i would even argue that according to her structure, even millions of records should only takes seconds). Try adding index to one of ur very fast query and see if u insist index gets u faster
there is reason why companies do index adding process and not initialize them at the beginning when creating the tables
"I find no reason of storing GRN this 3 character into database..."
it's true that just using digits are better, but really now, we don't really have to be that picky, this is not a critical thing, I could imagine this suggestion will be prioritized to the last item in a workplace.
"why dont make use of auto increment that provided?"
well, from what I see according to the information tatacat gave, there can be two GRN01 record, apple and mango,
thus it's not incremental, it could be 1,1,1,1,2,3,3,4 for GRN.
and as i said GRN Number and Product will defines the primary key to prevent duplications, and if GRN Number and Product infact do not provide uniqueness, as i said, u can create incremental key, just that do not make that column as an index alone.
|