database question

is the performance of a database significantly different if your table is indexed (i.e. primary key) by an integer rather than a text value?

Re: database question

it depends.

if the db can process text queries efficiently then ...... does not matter
if db requires extensive resources and proceesing time while handling text-related operations..... go for int

Re: database question

:hmmm:

Re: database question

Well...I realy dont have an idea...But if we take a look at the procedure...text /string values are a little far away from computer. Computer has to do a lot of conversion of characters at lower level while for integer values, it do less than...

Also It depends on the size of database & DB product.

Re: database question

Generally speaking integer is always faster than text. How much faster; will depend on lots of different parameters.

Regards

Re: database question

yes

but if the db manipulates integers as text-strings...

Re: database question

Best way IMO is to move away from explicitly creating queries, often badly written. Frameworks like Hibernate for Java offer increased performance, make use of clever techniques while offering the user a much simplified object model.

Re: database question

Java is just a child's playground as compared to (bad) programming languages used by Java's developers (C\C++). But for a Java programmer it is better than C\C++ because it provides automatic garbage collection. THE best java programmer can play with memory more effieciently than a C\C++ newbie, but he can never write more efficient and fast code in Java than the well-written C\C++ code entered by an average C\C++ programmer.

similarly if Java programmer cannot write queries himself, he can use the sql query-builders that can do well in general cases but a knowledgeable person can write more efficient queries in many cases.

It is not limited to Java, many C\C++ compilers claim to provide better execution speeds than assembly code but that is valid only if you write assembly-code the way they specify. A person with enough knowledge of the machine and assembly language will always write faster code than anyone using C\C++.