Re: [SQL] Best database structure for timely ordered values

2000-12-18 Thread Tom Lane
Reiner Dassing <[EMAIL PROTECTED]> writes: > Here is another example, which is even worse: > select value from table where id=1 order by epoch desc limit 1; > to ask for the last stored value. > This request needs about 5 minutes to complete. Hm. That should produce a decent plan given the right

Re: [SQL] Best database structure for timely ordered values

2000-12-18 Thread Reiner Dassing
Bruce Momjian wrote: > > The larger problem is that count(*) doesn't use the index at all. It > just does a sequential scan of the heap table. Here is another example, which is even worse: select value from table where id=1 order by epoch desc limit 1; to ask for the last stored value. This re

Re: [SQL] Best database structure for timely ordered values

2000-12-18 Thread Bruce Momjian
> > I assume the user is concerned about non-balanced btrees. > That is correct! > As I tested an example database with about 7 million entries on PostgreSQL V > 6.5.2 > and the result of > select count(*) from table; > tooks about 3 minutes I have this concern. > May be version 7.0.3 will give

Re: [SQL] Best database structure for timely ordered values

2000-12-18 Thread Reiner Dassing
Bruce Momjian wrote: > > > Reiner Dassing <[EMAIL PROTECTED]> writes: > > > The primary index must be the epoch. > > > As there will be no deletion from this data I fear - due to the > > > internal representation of B-trees - the performance will degrade very > > > soon. > > > > Nonsense. btree

Re: [SQL] Best database structure for timely ordered values

2000-12-18 Thread Bruce Momjian
> Reiner Dassing <[EMAIL PROTECTED]> writes: > > The primary index must be the epoch. > > As there will be no deletion from this data I fear - due to the > > internal representation of B-trees - the performance will degrade very > > soon. > > Nonsense. btree should work just fine for that. Use

Re: [SQL] Best database structure for timely ordered values

2000-12-18 Thread Tom Lane
Reiner Dassing <[EMAIL PROTECTED]> writes: > The primary index must be the epoch. > As there will be no deletion from this data I fear - due to the > internal representation of B-trees - the performance will degrade very > soon. Nonsense. btree should work just fine for that. Use a timestamp co

[SQL] Best database structure for timely ordered values

2000-12-18 Thread Reiner Dassing
Hi! I am thinking about the best structure of a database to describe timely ordered values. The timely ordered values are the results of different sensors measuring environmental parameters like temperatur, pressure, humidity. The database has to define the kind of measurements, kind of sensors,