Re: PostgreSQL versus MySQL for GPS Data - Mailing list pgsql-general

From Merlin Moncure
Subject Re: PostgreSQL versus MySQL for GPS Data
Date
Msg-id b42b73150903170618n1a97ba6hdfe5adb594f83183@mail.gmail.com
Whole thread Raw
In response to Re: PostgreSQL versus MySQL for GPS Data  (Craig Ringer <craig@postnewspapers.com.au>)
Responses Re: PostgreSQL versus MySQL for GPS Data  (Harald Armin Massa <chef@ghum.de>)
List pgsql-general
On Tue, Mar 17, 2009 at 7:47 AM, Craig Ringer
<craig@postnewspapers.com.au> wrote:
> Juan Pereira wrote:
>
>
>> - The database also should create a table for every truck -around 100
>> trucks-.
>
> Why?
>
> That's a rather clumsy design that makes it really hard to get aggregate
> data across the fleet or do many interesting queries.
>
> You're almost always better off using a single table with a composite
> primary key like (truckid, datapointid) or whatever. If you'll be doing
> lots of queries that focus on individual vehicles and expect performance
> issues then you could partition the table by truckid, so you actually do
> land up with one table per truck, but transparently accessible via table
> inheritance so you can still query them all together.
>
> Read up on PostgreSQL's table partitioning features.

If there is little/no reason to span queries over various trucks, then
the OP's approach is ok, better than standard TP even.  I agree though
that a single table approach is best unless 1) the table has to scale
to really, really large sizes or 2) there is a lot of churn on the
data (lots of bulk inserts and deletes).

merlin

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: What are the benefits of using a clustered index?
Next
From: Tino Wildenhain
Date:
Subject: Re: Uploading data to postgresql database