LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How exactly is a database indexed? (https://www.linuxquestions.org/questions/linux-server-73/how-exactly-is-a-database-indexed-766890/)

abefroman 11-04-2009 02:51 PM

How exactly is a database indexed?
 
How exactly is a database indexed?

I have a database with over 700,000 records in it, and it is contantly creating a file in /tmp, up to 2GB and using up all the cpu.

Would indexing help with that problem?

pcunix 11-04-2009 03:03 PM

Nobody can answer your question fully without knowing WHAT database this is.

PTrenholme 11-04-2009 04:03 PM

Quote:

Originally Posted by pcunix (Post 3744781)
Nobody can answer your question fully without knowing WHAT database this is.

And, even then, you may (almost certainly will) have several different indexing options.

If you're using a SQL-based data base, you can (for most such data bases) have several different indexes on the same table, each index "tuned" for specific queries. Generally, though, the design of a data base starts by analyzing the purpose for which the data base is being created, and the questions that the data will address, Then the data is separated into one of the normal forms (usually the third) and a "unique key" assigned to each row of each table. If this is done properly, then almost every query can be answered by combining information from the data base tables using the "unique key" values from the several tables used to answer the query.

Again, referring to SQL-based data bases, you can (usually) create a "view" of the data base for common queries, and index the view to speed recovery of specific rows from the view.


All times are GMT -5. The time now is 03:48 PM.