473,486 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Join with equals?

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 as q1, tq2.value as q2 from cal_quat_1 tq1 inner join
cal_quat_2 as tq2 using (timestamp) where timestamp > '2004-01-12
09:47:56.0000 +0' and timestamp < '2004-01-12 09:50:44.7187 +0' order
by timestamp;

telemetry=> \d cal_quat_1
Table "cal_quat_1"
Column | Type | Modifiers
-----------+--------------------------+-----------
timestamp | timestamp with time zone |
value | double precision |

telemetry=> \d cal_quat_2
Table "cal_quat_2"
Column | Type | Modifiers
-----------+--------------------------+-----------
timestamp | timestamp with time zone |
value | double precision |

My understanding of an inner join is that the query above will restrict
this to finding tq1.timestamp, tq1.value and then move onto t12.value
to search the subset. I have tried this with and without the '=' sign
and it isn't clear if it is making any difference at all. I have not
allowed the query to finish as it seems to take more than 10 minutes.
Both timestamps are indexed and I expect about 150 rows to be returned.
At the end of the day, I have four identical tables of quaternions
(timestamp, value) and I need to extract them all for a range of
timestamps.

Cheers,
Randall
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 22 '05 #1
1 1467
On Wed, Feb 18, 2004 at 11:58:24AM -0500, Randall Skelton wrote:
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 as q1, tq2.value as q2 from cal_quat_1 tq1 inner join
cal_quat_2 as tq2 using (timestamp) where timestamp > '2004-01-12
09:47:56.0000 +0' and timestamp < '2004-01-12 09:50:44.7187 +0' order
by timestamp;
Please run ANALYZE and then send the EXPLAIN ANALYZE <query> output.
--
Martijn van Oosterhout <kl*****@svana.org> http://svana.org/kleptog/ If the Catholic church can survive the printing press, science fiction
will certainly weather the advent of bookwarez.
http://craphound.com/ebooksneitherenorbooks.txt - Cory Doctorow


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQFANpCVY5Twig3Ge+YRAmmtAJ0ZbL9n8WzSDwKyTBsEFy dGxMi4AwCfetzv
z1EzgFs/NuFcH16sxqA+//E=
=Wp1O
-----END PGP SIGNATURE-----

Nov 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
5015
by: tekanet | last post by:
Hi folks, I'm new with MySQL and I'm really impressed by this database engine. While waiting for Stored Procedures :) (ver 5: anyone can say when will be, approximately, released?), due to the...
8
1624
by: jason.teen | last post by:
Hi, Is it possible to join on an alias for a field value on-the-fly. Something like the nz() function, but not only for Null values. I want it to be for anything I stipulate as equivalent. ...
1
5224
by: mcyi2mr3 | last post by:
Hi Help! Im stuck on a join query. Im trying to get distinct (the same row returned only once) user_id and forename from a tbl of users (they are always distinct) where user_id in that tbl...
4
18914
by: Darren Woodbrey | last post by:
I am trying to update 1 table with the top records from another table for each record in the first table UPDATE HPFSLOWMOVING SET TOP 1 LASTRCTDATE = (SELECT DOCDATE FROM IV30300 INNER JOIN...
4
6772
by: shapper | last post by:
Hello, I have 2 tables: Aid, Aname ... Bid, Aid, Bname ... I need to get the records in B given a Bname and a Aname. I think I should use Inner Join. I wrote the following code:
0
971
by: john | last post by:
I get the following error on this Join Statement, but I thought the idea of a LINQ Join is bring together different Data Context, the Intellisene shows me both tables as a Result; any help is...
4
1593
by: shapper | last post by:
Hello, I have a list named Form which is a List(Of Tag) where Tag is an object with two properties: ID and Name. I want to define a variable named Check that: 1. Is True if all Tags in Form...
0
984
by: shapper | last post by:
Hello, I have three tables: Posts, Tags and PostsTags which relates Tags to Posts. I created the dbml file. I have a List(Of Tag) named "form" with the Name defined for each tag. I need to...
0
893
by: dlouche | last post by:
I have a method that contains the linq query: var query = from c in db.Categories join pc in db.ProductsToCategories on c.ID equals pc.CategoryID where...
0
7100
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5434
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.