[GENERAL] Join with equals?

2004-02-20 Thread Randall Skelton
Greetings all, I am trying to do what should be a simple join but the tables are very large and it is taking a long, long time. I have the feeling that I have stuffed up something in the syntax. Here is what I have: telemetry=> select (tq1.timestamp = tq2.timestamp) as timestamp, tq1.value a

[GENERAL] Simplyfying many equals in a join

2004-02-25 Thread Randall Skelton
Many thanks to all who pointed out the usefulness of the 'ANALYZE' command in my last question. I assumed the db admin was doing 'VACUUM ANALYZE' after each days insert but he wasn't. Is there a shorthand notation when performing a multi-table join and one column is to be equaled in all tables? i

[GENERAL] returning row numbers in select

2004-03-10 Thread Randall Skelton
Is there a way to return an integer row number for a query? Note that there may be a large number of rows so I would rather not have joined selects... For a rather simple query: SELECT timestamp from test WHERE timestamp > '2004-02-02 04:15:00.00 +0' ANDtimestamp < '2004-02-02 04:15:10.00

[GENERAL] Looking for a multithreaded (pthread) libpq example

2004-03-30 Thread Randall Skelton
Does anyone have a simple example showing how to perform non-blocking queries using libpq that they can post? Thus far I can initiate a non-blocking connection, and use PQsendQuery but I am having a hard time figuring out when and how to consume the results. Cheers, Randall ---

[GENERAL] Sub-query too slow

2004-03-31 Thread Randall Skelton
Can someone please explain how I can make this sub-query faster? In the case below, 'test' is a temporary table but I have tried with test being a full, indexed, and 'vacuum analysed' table and it still takes more than 130 seconds. Note that 'test' has very few rows but 'cal_quat_1' has many

[GENERAL] Storage cost of a null column

2004-04-02 Thread Randall Skelton
What is the storage cost of a null entry in a column? i.e. does a null entry of type integer, float8 or text consume the same amount of storage as one that is filled? I ask because I have satellite data which is transmitted via a dodgy RF link that drops data packets. This means I have a num

[GENERAL] extract epoch and index scanning

2004-04-08 Thread Randall Skelton
Can someone explain why the latter query uses an index scan while the former uses a sequence scan? I have tried all sorts of casting in the first case but I cannot get the index scan. Cheers, Randall == data=> EXPLAIN ANALYZE SELECT acqtimestamp FROM aux_datarecord where acqtimestamp between (