473,796 Members | 2,826 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why does this query take forever?

Ike
For some reason, I have a rather large (to me) query, with numerous inner
joins, accessing a remote server, and it is taking about twenty times longer
than most queries to the same database.
The query itself is built programmaticall y within my application, and
example of which is below. I am hoping someone in the group may have some
insight into why this query is so slow, suggesting perhaps a better
structure for it, such that I can go back in and rewrite my code that
creates such queries.

Thanks in advance, Ike

"SELECT DISTINCT
chronology.id,s tatus_id.status ,chronology.com pleted,chronolo gy.completeddat e
,chronology.com pletedtime,acti vities_id.activ ity,chronology. activities_acti v
ity,chronology. activities_atta chment,chronolo gy.activities_a vailable_to_all ,
chronology.upca rds_firstnamela stname,upcard_i d.id,chronology .feedbackrequir e
d,chronology.la ndondate,chrono logy.hasspecifi ctime,chronolog y.datetoperform ,
chronology.time toperform,chron ology.duration, chronology.week ends,chronology .
prefix,statusac tivitieisid.id, associaterespon sible.username, activities_user n
ameid.username, chronology.edit Flag FROM
chronology,stat us,activities,u pcards,statusac tivities,associ ates
INNER JOIN status status_id on chronology.stat us_id=status_id .id
INNER JOIN activities activities_id on
chronology.acti vities_id=activ ities_id.id
INNER JOIN upcards upcard_id on chronology.upca rd_id=upcard_id .id
INNER JOIN statusactivitie s statusactivitie isid on
chronology.stat usactivitieisid =statusactiviti eisid.id
INNER JOIN associates associaterespon sible on
chronology.asso ciateresponsibl e=associateresp onsible.id
INNER JOIN associates activities_user nameid on
chronology.acti vities_username id=activities_u sernameid.id
WHERE chronology.upca rd_id = 18"
Jul 19 '05
10 2179
which database server are you using (sql server, oracle, db2)?

"Ike" <rx*@hotmail.co m> wrote in message
news:xb******** ***********@new sread2.news.atl .earthlink.net. ..
For some reason, I have a rather large (to me) query, with numerous inner
joins, accessing a remote server, and it is taking about twenty times longer than most queries to the same database.
The query itself is built programmaticall y within my application, and
example of which is below. I am hoping someone in the group may have some
insight into why this query is so slow, suggesting perhaps a better
structure for it, such that I can go back in and rewrite my code that
creates such queries.

Thanks in advance, Ike

"SELECT DISTINCT
chronology.id,s tatus_id.status ,chronology.com pleted,chronolo gy.completeddat e ,chronology.com pletedtime,acti vities_id.activ ity,chronology. activities_acti v ity,chronology. activities_atta chment,chronolo gy.activities_a vailable_to_all , chronology.upca rds_firstnamela stname,upcard_i d.id,chronology .feedbackrequir e d,chronology.la ndondate,chrono logy.hasspecifi ctime,chronolog y.datetoperform , chronology.time toperform,chron ology.duration, chronology.week ends,chronology . prefix,statusac tivitieisid.id, associaterespon sible.username, activities_user n ameid.username, chronology.edit Flag FROM
chronology,stat us,activities,u pcards,statusac tivities,associ ates
INNER JOIN status status_id on chronology.stat us_id=status_id .id
INNER JOIN activities activities_id on
chronology.acti vities_id=activ ities_id.id
INNER JOIN upcards upcard_id on chronology.upca rd_id=upcard_id .id
INNER JOIN statusactivitie s statusactivitie isid on
chronology.stat usactivitieisid =statusactiviti eisid.id
INNER JOIN associates associaterespon sible on
chronology.asso ciateresponsibl e=associateresp onsible.id
INNER JOIN associates activities_user nameid on
chronology.acti vities_username id=activities_u sernameid.id
WHERE chronology.upca rd_id = 18"

Jul 19 '05 #11

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

Similar topics

1
2499
by: John Ramsden | last post by:
I have a script running on PHP v4.3.6 (cgi) that hangs forever in a call to the Postgres pg_get_result() function when and only when the query length is 65536 or more bytes. The query is a simple INSERT, of a single ASCII value into a 'text' type field, and works fine for shorter queries. (As the code first calls pg_escape_string() on the value to be inserted, I'm sure the problem doesn't relate to bad characters in the data.)
54
3988
by: seberino | last post by:
Many people I know ask why Python does slicing the way it does..... Can anyone /please/ give me a good defense/justification??? I'm referring to why mystring gives me elements 0, 1, 2 and 3 but *NOT* mystring (5th element). Many people don't like idea that 5th element is not invited. (BTW, yes I'm aware of the explanation where slicing
5
3145
by: Shay | last post by:
essentially I am trying to do some counts based on some assumptions in the recordset. So I get the RS back, put the values into a variable, move to the next record in the RS and compare what is in the variable to the value in the next record in the recordset and do a count. Then overwrite the value in the variables and do the same for the next record and so. But this runs extremly slow. 5000 records takes about 10 minutes in IE6 and I...
5
1745
by: jim Bob | last post by:
Hi, Can someone help with a simple query? I have a table with the following. Firstname Lastname InterviewerID1 InterviewerID2 InterviewerID3 ...
34
4477
by: NewToCPP | last post by:
Hi, Why does a C/C++ programs crash? When there is access to a null pointer or some thing like that programs crash, but why do they crash? Thanks.
4
3135
by: Stan | last post by:
I am using MS Office Access 2003 (11.5614). My basic question is can I run a query of a query datasheet. I want to use more that one criteria and can not get that query to work. I thought I might be able to accomplish the results in two steps by using two queries. If this is possible how can I do it? Thank you, Stan Hanna
1
1782
by: gkinu | last post by:
I have 2 tables with a parent-child relationship. Parent table's primary key field is Entry_no and is of type VarChar(50). This parent table has about 50 fields. The child has 3 fields, Entry_No (varchar(50), Requestor char(3) and id (integer). I need the following query QUERY 1. select p.entry_no, p.reg_date from tparent p, tchild c where p.entry_no<>c.entry_no and c.requestor='KPA' order by p.reg_date, p.entry_no; The above query...
13
4177
by: Neil | last post by:
I'm running an update query in SQL 7 from QA, and it runs forever. Has been running for 20 minutes so far! The query is quite simple: update a single field in a table, based on a join with another table. There are a total of 1200 rows that are affected (out of a total of 60,000 in the table). Should not take 20 minutes! Also, retrieving the 1200 rows using the same criteria is instantaneous. Anyone have any idea what's going on? Here's...
6
4410
by: jsacrey | last post by:
Hey everybody, got a secnario for ya that I need a bit of help with. Access 97 using linked tables from an SQL Server 2000 machine. I've created a simple query using two tables joined by one field between them. The join field in both tables are indexed and I'm selecting 1 field from each table to lookup. The Access query is taking more than 60 second to retrieve 1 record and if I execute the same query within the Query Analyzer, it...
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10452
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10221
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10169
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.