Take the 2-minute tour ×

I have to create one table that contains 30 columns and thousands of row. How do I manage this?

Is there any data structure like B+ tree for tables which stores non required data in disk?

I have to implement it using Java/JDBC.

Any idea?

share|improve this question
Are you saying you want to write a DBMS from scratch? Or just use an existing one (like Oracle or MySQL) via JDBC? –  Thilo Dec 22 '10 at 6:34
Depending on the scenario you might also look at search engines like Lucene –  sjngm Dec 22 '10 at 6:38
It seems like the answer to the question you actually asked is "Yes, an indexed database." Maybe you could make it more specific? –  Affe Dec 22 '10 at 6:39
I want to create this table with more than 3o columns and thousands of row. So my question is how do I design it? –  user449355 Dec 22 '10 at 6:45
What's your use case? –  fish Dec 22 '10 at 7:22
add comment

2 Answers

up vote 0 down vote accepted

I'd base an in-memory solution on a structure like

Map<Object, DataType> table

and either choose a HashMap if I wanted fast read and insert of single rows or a TreeMap if sorted output based on the keys is a typical scenario.

Big is - as always - pretty relative. You can assign additional heap space to the virtual machine, so that the memory consumption of that table is "peanuts".

DataType, by the way, is some java class that holds all values for a table entry.

If persistence is a requirement, define the table on your existing database engine and develop some SQL query statements to just read the required data.

share|improve this answer
add comment

NTFS, ReiserFS, NSS, XFS, and JFS filesystems all use this type of tree for metadata indexing. Relational database management systems such as IBM DB2, Informix, Microsoft SQL Server, Oracle 8, Sybase ASE, PostgreSQL, Firebird, MySQL and SQLite support this type of tree for table indices.

And thousands of records are normal in enterprise applications.

Applying indexes on fields that are frequently retrieved, it would make search better but will affect insertion.

Try normalizing the database further if possible.

At application layer, you can use Caching API's like OSCache, EHCache, JCache etc.

share|improve this answer
add comment

Your Answer


