SQL Help   Independent houses near kukatpally | Apartments in Pragathi Nagar | AndhraVaani.com | Log Out | Topics | Search
Register | Edit Profile

Bewarse Talk � Archives � Cine Talk - Reviews, Gossips, Insider Info etc. � Archive through July 25, 2006 � SQL Help � Previous Next �

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Minneapolis
Kurra Bewarse
Username: Minneapolis

Post Number: 878
Registered: 04-2005
Posted From: 167.79.91.20
Posted on Tuesday, July 18, 2006 - 1:22 pm:   Edit PostDelete PostView Post/Check IP

Tmbuff mama thanks very much for helping.

Nuvvu cheppina query perfect ga work chestundhi..it is returning the exact expected set of results..

Thanks once again to PD and Penkonda mamas also..
Top of pagePrevious messageNext messageBottom of page Link to this message

Tmbuff
Pilla Bewarse
Username: Tmbuff

Post Number: 153
Registered: 04-2004
Posted From: 159.153.4.51
Posted on Tuesday, July 18, 2006 - 1:04 pm:   Edit PostDelete PostView Post/Check IP

oops ..

here is correct SQL

SELECT END_DT as END_DT,
STRT_DT as STRT_DT,
PERS_ID as PERS_ID
from (SELECT END_DT, STRT_DT, PERS_ID, MAX(STRT_DT) OVER (PARTITION BY PERS_ID) AS MAX_ST_DT
FROM WDW.DLT_TEMP)
WHERE MAX_ST_DT =STRT.DT
Top of pagePrevious messageNext messageBottom of page Link to this message

Minneapolis
Kurra Bewarse
Username: Minneapolis

Post Number: 876
Registered: 04-2005
Posted From: 167.79.91.21
Posted on Tuesday, July 18, 2006 - 1:01 pm:   Edit PostDelete PostView Post/Check IP

Tmbuff mama nuvvu icchina query run chesthe ee following error throw chestundhi...do u have any idea what changed need to be done to the query..

ORA-00923: FROM keyword not found where expected, Batch 1 Line 4 Col 63

after showing the error the cursor is being placed in between partition and OVER....
Top of pagePrevious messageNext messageBottom of page Link to this message

Proofdadaa
Pilla Bewarse
Username: Proofdadaa

Post Number: 264
Registered: 06-2006
Posted From: 129.138.18.85
Posted on Tuesday, July 18, 2006 - 12:18 pm:   Edit PostDelete PostView Post/Check IP

one person ki fast gane vastundi mama..say 1 sec.
for 30k persons 30k seconds..i.e 8 hrs

PLAN_TABLE ki write access kavaali mama..mee DBA neeku aa privilege iste explain plan vastundi..

nenu choostunna query ela marcha vachaa ani
Top of pagePrevious messageNext messageBottom of page Link to this message

Tmbuff
Pilla Bewarse
Username: Tmbuff

Post Number: 152
Registered: 04-2004
Posted From: 159.153.4.51
Posted on Tuesday, July 18, 2006 - 12:17 pm:   Edit PostDelete PostView Post/Check IP

Minneapolis mama --

that query was poorly written. You can try this. This should give you better performance. I didn't validate the Query. If you are not getting correct results let me know.

SELECT END_DT as END_DT,
STRT_DT as STRT_DT,
PERS_ID as PERS_ID
from (SELECT END_DT, STRT_DT, PERS_ID, MAX(STRT_DT) PARTITION OVER BY (PERS_ID) AS MAX_ST_DT
FROM WDW.DLT_TEMP)
WHERE MAX_ST_DT =STRT.DT
Top of pagePrevious messageNext messageBottom of page Link to this message

Minneapolis
Kurra Bewarse
Username: Minneapolis

Post Number: 875
Registered: 04-2005
Posted From: 167.79.91.21
Posted on Tuesday, July 18, 2006 - 12:12 pm:   Edit PostDelete PostView Post/Check IP

PD mama nenu execution plan kosam a query koduthunte insufficient privileges antundhi..

so maa DBA ni adigithe query execution plan isthundhaa?

nuvvu cheppina logic ne mostly i m trying to implemement actually.. for each person ther will be 3 or 4 records with different start dates and end dates..all i want to do is get the max start date for each person return that record...

so when i run the query for only one person it is returning the exact results with in no time..but nenu cheppina logic ni inthakante better ga rayochha..
Top of pagePrevious messageNext messageBottom of page Link to this message

Proofdadaa
Pilla Bewarse
Username: Proofdadaa

Post Number: 261
Registered: 06-2006
Posted From: 129.138.18.85
Posted on Tuesday, July 18, 2006 - 12:04 pm:   Edit PostDelete PostView Post/Check IP

say emp a has 10 strt_dates.
adi 10 dates ki max calculate chesi aa date tho malli 10 dates ni compare chesi equal aina dates istundi. For this case, 10 logical reads + grouping overhead.
ikkade potundi..
Top of pagePrevious messageNext messageBottom of page Link to this message

Proofdadaa
Pilla Bewarse
Username: Proofdadaa

Post Number: 260
Registered: 06-2006
Posted From: 129.138.18.85
Posted on Tuesday, July 18, 2006 - 11:56 am:   Edit PostDelete PostView Post/Check IP

SQL>
EXPLAIN PLAN
SET statement_id = <statement_identifier>
FOR
<SQL statement here>;



SQL>
SELECT LPAD(' ',2*(level-1)) || operation || ' ' || options ||' ' || object_name || ' ' ||
DECODE(id,0,'Cost = ' || position) QUERY_OUTPUT
FROM plan_table
START WITH id = 0
AND statement_id = 'abc'
CONNECT BY PRIOR id = parent_id
AND statement_id = 'abc';


neeku PLAN_TABLE ki write access vundaali..query plan choodataaniki..first step lo SET daggara nuvvu nee query statement id ni table liki rastunnav..mee DBA ni adugu istaadu..
Top of pagePrevious messageNext messageBottom of page Link to this message

Penkonda_tiger
Bewarse
Username: Penkonda_tiger

Post Number: 1645
Registered: 06-2005
Posted From: 193.178.209.212
Posted on Tuesday, July 18, 2006 - 11:55 am:   Edit PostDelete PostView Post/Check IP

I am leaving my office now in Brussels .. catch you back in 2 hours when back in Amsterdam
Top of pagePrevious messageNext messageBottom of page Link to this message

Penkonda_tiger
Bewarse
Username: Penkonda_tiger

Post Number: 1644
Registered: 06-2005
Posted From: 193.178.209.212
Posted on Tuesday, July 18, 2006 - 11:53 am:   Edit PostDelete PostView Post/Check IP

mamma ...

at SQL prompt type in the following

SQL>ALTER SESSION SET SQL_TRACE = TRUE
SQL> yourSQL ;
SQL>ALTER SESSION SET SQL_TRACE = FALSE

CMD promt loo TKPROF seyeee ... for the tkprof you need the trace file located on the Oracle server instance
Top of pagePrevious messageNext messageBottom of page Link to this message

Minneapolis
Kurra Bewarse
Username: Minneapolis

Post Number: 874
Registered: 04-2005
Posted From: 167.79.91.21
Posted on Tuesday, July 18, 2006 - 11:51 am:   Edit PostDelete PostView Post/Check IP

PD mama...motham table lo 130k records vunnayi...kaani aa query return cheyyalsindhi only around 40k ..endhukante distinct pers_id vacchesi only 40k vunnayi kabhatti..

ayithe ippudu date fields join ki round about emayinaa vundhaa..
Top of pagePrevious messageNext messageBottom of page Link to this message

Proofdadaa
Pilla Bewarse
Username: Proofdadaa

Post Number: 259
Registered: 06-2006
Posted From: 129.138.18.85
Posted on Tuesday, July 18, 2006 - 11:48 am:   Edit PostDelete PostView Post/Check IP

date fields meeda general gaa index vundavu mama..nee query lo date fields meeda join vundi..so akkada slow avutundi anukunta..

asaalu table lo enni records vunnayi mottam??
Top of pagePrevious messageNext messageBottom of page Link to this message

Minneapolis
Kurra Bewarse
Username: Minneapolis

Post Number: 873
Registered: 04-2005
Posted From: 167.79.91.21
Posted on Tuesday, July 18, 2006 - 11:44 am:   Edit PostDelete PostView Post/Check IP

Penkonda mama nenu vaade tool lo Execution plan elaa vadaalo teliyadam ledhu..i have been trying to get it..permissions vunnayo ledho teleedhu firs thing...but SQL plus nundi elaa execution plan generate cheyyoccho telusaa mama neeku..so that i can send it to u..
Top of pagePrevious messageNext messageBottom of page Link to this message

Babu
Desanike Pedda Bewarse
Username: Babu

Post Number: 8881
Registered: 06-2004
Posted From: 65.208.22.26
Posted on Tuesday, July 18, 2006 - 11:24 am:   Edit PostDelete PostView Post/Check IP

prob cud be u r using same table mama and with nested loops, it is going to take some time..

one suggestion check whether the indexes r defined and statistics r updated accordingly

other thing is see the explain table along with statistics u get to know what is that subquery that is taking more load

final suggestion is split the query and then execute and deduce which one is taking longer..
like check exists part and see
Top of pagePrevious messageNext messageBottom of page Link to this message

Penkonda_tiger
Bewarse
Username: Penkonda_tiger

Post Number: 1643
Registered: 06-2005
Posted From: 193.178.209.212
Posted on Tuesday, July 18, 2006 - 11:24 am:   Edit PostDelete PostView Post/Check IP

Minneapolis mamma ...

can you make an SQL TRACE , and TKPROF it and send the Execution plan to zimchak@gmail.com
Top of pagePrevious messageNext messageBottom of page Link to this message

Minneapolis
Kurra Bewarse
Username: Minneapolis

Post Number: 872
Registered: 04-2005
Posted From: 167.79.91.21
Posted on Tuesday, July 18, 2006 - 11:22 am:   Edit PostDelete PostView Post/Check IP

Hemanth mama SQL tho ekkuva nuvve invlove avuthaavu kadhaa..but no problem anyways..

evarayinaa help chesthe that would be a lot to me..ikkade aagi poyindhi naa work anthaa
Top of pagePrevious messageNext messageBottom of page Link to this message

Hemanth
Bewarse ke Bewarse!
Username: Hemanth

Post Number: 18391
Registered: 03-2004
Posted From: 65.196.167.82
Posted on Tuesday, July 18, 2006 - 11:19 am:   Edit PostDelete PostView Post/Check IP

naku anthaga theliyadu mama. :-(
Top of pagePrevious messageNext messageBottom of page Link to this message

Minneapolis
Kurra Bewarse
Username: Minneapolis

Post Number: 871
Registered: 04-2005
Posted From: 167.79.91.21
Posted on Tuesday, July 18, 2006 - 11:14 am:   Edit PostDelete PostView Post/Check IP

mama ee query ni evarayina optimize cheyyagalaraa..

its taking forever and ever..return chese records emi anni ekkuva levu..any suggestions to make it better. DBA daggara ki velli adugudhamani vundhi..kaani intha chinna query ki adigithe dobbutharemo ani doubt..

SELECT a.END_DT as END_DT,
a.STRT_DT as STRT_DT,
a.PERS_ID as PERS_ID
FROM
WDW.DLT_EMP a
WHERE EXISTS(SELECT 1 FROM WDW.DLT_EMP b
GROUP BY PERS_ID HAVING MAX(b.STRT_DT) =a.STRT_DT AND
b.PERS_ID =a.PERS_ID)