p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Database > Oracle ASP
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Oracle ASP Using ASP with Oracle databases. For Oracle discussions not specific to ASP, please see the Oracle forum. For more ASP discussions, please see the ASP forum category.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle ASP section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 8th, 2008, 01:26 AM
Authorized User
Points: 45, Level: 1
Points: 45, Level: 1 Points: 45, Level: 1 Points: 45, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2008
Location: , , .
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
Default Increase Performance of main query

I am currently running an application which run dynamically. The current problem that i have is that when i run my app. it times out because the main query takes too long to run. If anyone could suggest anyway anyway that i could increase the performance i would appreciate it.
**The app is written in asp.net and im using oracle database, and unfortunatly i can't make this a stored procedure, so any suggestions on modifying what i currently have would be great**

Code:

Code:
FROM TABLE 
    tDataSQL = tDataSQL &" FROM customer_data.cd_bk_player_ytd_stats main," &_ 
    "(SELECT team_id, game_type_id, league_id, team_id_1032, season_id, SUM(plus_minus) AS plus_minus " &_ 
    " FROM customer_data.cd_bk_player_game_stats " &_ 
    " WHERE season >= " & iSeasonMinPlusMinus &_ 
    " AND split_number = 0" &_ 
    " AND game_type_id =" & iGameType &_ 
    " GROUP BY player_id, team_id, game_type_id, league_id, team_id_1032, season_id) gs" 

    If iRosterType = ACTIVEPLAYERS Then 
    tDataSQL = tDataSQL &" customer_data.cd_bk_roster ros," &_ 
    "(SELECT player_id, player_id_1032, league_id, team_id," &_ 
    " team_id_1032, conf_id, position_id, season_id, SUM(pus_minus) AS plus_minus " &_ 
    " FROM customer_data.cd_bk_player_game_stats " &_ 
    " WHERE season >= " & iSeasonMinPlusMinus &_ 
    " AND split_number = 0" &_ 
    " AND game_type_id =" & iGameType &_ 
    " GROUP BY player_id, player_id_1032, league_id, team_id, team_id_1032, conf_id, position_id, season_id) gs" 

    End If 

    tOppSQL = Replace(tTotalSQL,"main.","main.opp_") &" FROM customer_data.cd_bk_team_ytd_stats main," &_ 
    "(SELECT team_id, game_type_id, league_id, team_id_1032, season_id, SUM(plus_minus) AS plus_minus " &_ 
    " FROM customer_data.cd_bk_player_game_stats " &_ 
    " WHERE season >= " & iSeasonMinPlusMinus &_ 
    " AND split_number = 0" &_ 
    " AND game_type_id =" & iGameType &_ 
    " GROUP BY team_id, game_type_id, league_id, team_id_1032, season_id) gs" 


    tTotalSQL = tTotalSQL &" FROM customer_data.cd_bk_team_ytd_stats main," &_ 
    "(SELECT team_id, game_type_id, league_id, team_id_1032, season_id, SUM(plus_minus) AS plus_minus " &_ 
    " FROM customer_data.cd_bk_player_game_stats " &_ 
    " WHERE season >= " & iSeasonMinPlusMinus &_ 
    " AND split_number = 0" &_ 
    " AND game_type_id =" & iGameType &_ 
    " GROUP BY team_id, game_type_id, league_id, team_id_1032, season_id) gs" 


 'WHERE CLAUS (FILTERS) 

  tWhereSQL = " WHERE main.active_record <> 'R' "&_ 
                  " AND main.game_type_id ="& iGameType &_ 
                  " AND main.split_number = -1" &_ 
                " AND main.league_id IN (1,6)" &_ 
                " AND main.season = "& iSeason &_ 
                  " AND main.team_id_1032 = " & iID &_ 
                " AND gs.team_id = main.team_id" &_ 
                " AND gs.game_type_id = main.game_type_id" &_ 
                " AND gs.league_id = main.league_id" &_ 
                " AND gs.team_id_1032 = main.team_id_1032" &_ 
                " AND gs.season_id = main.season_id"     

  tDataSQL = tDataSQL & tWhereSQL 

  If iRosterType = ACTIVEPLAYERS Then 
    tDataSQL = tDataSQL &" AND main.player_id = ros.player_id" &_ 
                  " AND main.league_id = ros.league_id" &_ 
                 " AND ros.team_id = main.team_id" &_ 
                  " AND ros.status = 'Y'" &_ 
                " AND gs.player_id = ros.player_id" &_ 
                " AND gs.player_id_1032 = ros.player_id_1032" &_ 
                " AND gs.player_id = ros.player_id" &_ 
                " AND gs.leauge_id = ros.league_id" &_ 
                " AND gs.team_id = ros.team_id" &_ 
                " AND gs.team_id_1032 = ros.team_id_1032" &_ 
                " AND gs.conf_id = ros.conf_id" &_ 
                " AND gs.season_id = ros.season_id" &_ 
                " AND gs.player_id = main.player_id" &_ 
                " AND gs.player_id_1032 = main.player_id_1032" &_ 
                " AND gs.player_id = main.player_id" &_ 
                " AND gs.leauge_id = main.league_id" &_ 
                " AND gs.team_id = main.team_id" &_ 
                " AND gs.team_id_1032 = main.team_id_1032" &_ 
                " AND gs.conf_id = main.conf_id" &_ 
                " AND gs.season_id = main.season_id" 
  End If 
  tTotalSQL = tTotalSQL & tWhereSQL 
  tOppSQL = tOppSQL & tWhereSQL
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Query criteria from two tables in main connection MikeC MikeC Infopath 0 November 21st, 2007 03:16 AM
Increase The Performance Of My Queries Corey Access 4 February 20th, 2007 10:18 AM
query performance question kBusby Oracle 3 February 14th, 2005 04:42 PM
Query Performance pilmart Access ASP 0 April 22nd, 2004 08:16 AM
How to increase speed manishgore Pro VB Databases 5 March 2nd, 2004 05:17 PM



All times are GMT -4. The time now is 11:28 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc