user1816847
user1816847

Reputation: 2077

Presorted database table

I'm designing a database to hold scientific data. Each datum has a unique timestamp (in epoch time) and 8 doubles. I plan on keeping each experiment in its own table, which may get anywhere from 100,000-10,000,000 rows. I also for see the vast majority of DB reads to be from a single table at a time, requesting either every row in order of timestamp or some contiguous chunk of rows, again in chronological order by time stamp. I know that in the most abstract sense db data is unordered, but is there a way to give a hint to the database that most if not all queries will sort on a specific column, allowing the DB to keep everything in order by that column and speed up reads?

Incase it matters I'm using MySQL:

$ mysql --version
mysql  Ver 14.12 Distrib 5.0.95, for redhat-linux-gnu (i386) using readline 5.1

I'm also open to a DB different structure if that helps.

Upvotes: 0

Views: 499

Answers (1)

Lucas
Lucas

Reputation: 1516

If each timestamp is guarnateed to be different, then you could set that as a primary key, otherwise just create an index.

Upvotes: 2

Related Questions