Home | Webstore
Latest News: OOTP 26 Available - FHM 12 Available - OOTP Go! Available

Out of the Park Baseball 26 Buy Now!

  

Go Back   OOTP Developments Forums > Out of the Park Baseball 26 > OOTP Mods > OOTP Mods - Database Tools

OOTP Mods - Database Tools Do you need to take a dump? SQL gurus welcome

Reply
 
Thread Tools
Old 04-15-2007, 05:43 PM   #1
BMW
Hall Of Famer
 
BMW's Avatar
 
Join Date: May 2003
Location: New Jersey
Posts: 2,030
"Missing" indexes in MySQL

I have "Missing" with quotes, because there's always the tradeoff between storage space/performance.

There were a number of tables that are missing PRIMARY and/or indexes. Running these against your database should fix them up.

I haven't used these for an extended period of time, but I believe the worst error you would be likely to run into is that it cannot apply the index if there is a repeated key (i.e. In human_manager_history, there is more than one record for the same Manager, Managing the same Team, in the same Year. Yes, the way OOTP works, this should not happen, but a database cares not about OOTP and how managers work, it's just looking at a bunch of numbers.)

I didn't use a PRIMARY on the players_at_bat_batting_stats table, because even it doesn't happen often, a batter could face a pitcher twice within the same inning.

Code:
	ALTER TABLE `human_manager_history` ADD PRIMARY KEY ( `human_manager_id` , `team_id` , `year` ) ;
	ALTER TABLE `human_manager_history_batting_stats` ADD PRIMARY KEY ( `human_manager_id` , `team_id` , `year` ) ;
	ALTER TABLE `human_manager_history_fielding_stats_stats` ADD PRIMARY KEY ( `human_manager_id` , `team_id` , `year` ) ;
	ALTER TABLE `human_manager_history_financials` ADD PRIMARY KEY ( `human_manager_id` , `team_id` , `year` ) ;
	ALTER TABLE `human_manager_history_pitching_stats` ADD PRIMARY KEY ( `human_manager_id` , `team_id` , `year` ) ;
	ALTER TABLE `human_manager_history_record` ADD PRIMARY KEY ( `human_manager_id` , `team_id` , `year` ) ;
	ALTER TABLE `league_events` ADD PRIMARY KEY ( `league_id` , `start_date` , `type` ) ;
	ALTER TABLE `league_history` ADD PRIMARY KEY ( `league_id` , `sub_league_id` , `year` ) ;
	ALTER TABLE `league_history_all_star` ADD PRIMARY KEY ( `league_id` , `sub_league_id` , `year` , `all_star_pos` ) ;
	ALTER TABLE `league_history_batting_stats` ADD PRIMARY KEY ( `year` , `league_id` ) ;
	ALTER TABLE `league_history_fielding_stats` ADD PRIMARY KEY ( `year` , `league_id` , `sub_league_id` ) ;
	ALTER TABLE `league_history_pitching_stats` ADD PRIMARY KEY ( `year` , `league_id` ) ;
	ALTER TABLE `league_playoffs` ADD PRIMARY KEY ( `league_id` ) ;
	ALTER TABLE `league_playoff_fixtures` ADD PRIMARY KEY ( `league_id` , `team_id0` , `team_id1` ) ;
	ALTER TABLE `players_at_bat_batting_stats` ADD INDEX ( `player_id` ) ;
	ALTER TABLE `players_at_bat_batting_stats` ADD INDEX ( `game_id` ) ;
	ALTER TABLE `players_at_bat_batting_stats` ADD INDEX ( `opponent_player_id` ) ;
	ALTER TABLE `players_at_bat_batting_stats` ADD INDEX ( `team_id` ) ;
	ALTER TABLE `players_awards` ADD PRIMARY KEY ( `player_id` , `award_id` , `year` , `day` , `month` ) ;
	ALTER TABLE `players_career_batting_stats` ADD PRIMARY KEY ( `player_id` , `year` , `team_id` , `split_id` ) ;
	ALTER TABLE `players_career_fielding_stats` ADD PRIMARY KEY ( `player_id` , `year` , `team_id` , `split_id` , `position` ) ;
	ALTER TABLE `players_career_pitching_stats` ADD PRIMARY KEY ( `player_id` , `year` , `team_id` , `split_id` ) ;
	ALTER TABLE `players_game_batting` ADD PRIMARY KEY ( `player_id` , `year` , `team_id` , `game_id` ) ;
	ALTER TABLE `players_game_pitching_stats` ADD PRIMARY KEY ( `player_id` , `year` , `team_id` , `game_id` ) ;
	ALTER TABLE `players_individual_batting_stats` ADD PRIMARY KEY ( `player_id` , `opponent_id` ) ;
	ALTER TABLE `players_league_leader` ADD PRIMARY KEY ( `player_id` , `sub_league_id` , `year` , `category` ) ;
	ALTER TABLE `players_streak` ADD PRIMARY KEY ( `player_id` , `league_id` , `streak_id` , `started` ) ;
BMW is offline   Reply With Quote
Old 04-16-2007, 12:08 PM   #2
Comedian2004
Hall Of Famer
 
Comedian2004's Avatar
 
Join Date: Nov 2004
Location: In a house in Saint Cloud, Florida.
Posts: 7,085
Some of the tables are not really tables, but are in a sort of way. What I mean is, they are treated as tables, but there is no look up file.

Good example is the pitchers 'pitches', there is no dump that contains the actual pitchers, 'fastball, slider, etc.', but it is treated like a table.

Is this what you mean?
Comedian2004 is offline   Reply With Quote
Old 04-22-2007, 11:59 PM   #3
BMW
Hall Of Famer
 
BMW's Avatar
 
Join Date: May 2003
Location: New Jersey
Posts: 2,030
Quote:
Originally Posted by Comedian2004 View Post
Some of the tables are not really tables, but are in a sort of way. What I mean is, they are treated as tables, but there is no look up file.

Good example is the pitchers 'pitches', there is no dump that contains the actual pitchers, 'fastball, slider, etc.', but it is treated like a table.

Is this what you mean?
I know what you're saying... There are some fields that are enumerations (i.e. they hold a value that corresponds to items on a list, but those items are not stored in a table), but I'm not certain what it has to do with indexing tables.

For the queries above, all that is required is that you take a full MySQL file dump and run the files against your MySQL database. From that point on, once they become a physical table in a MySQL database, I am considering that a table.

The code just creates some indexes on those tables, which will enable them to run a little faster when you are doing JOINs or other routine things.

Last edited by BMW; 04-23-2007 at 12:00 AM.
BMW is offline   Reply With Quote
Reply

Bookmarks


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:47 PM.

 

Major League and Minor League Baseball trademarks and copyrights are used with permission of Major League Baseball. Visit MLB.com and MiLB.com.

Officially Licensed Product – MLB Players, Inc.

Out of the Park Baseball is a registered trademark of Out of the Park Developments GmbH & Co. KG

Google Play is a trademark of Google Inc.

Apple, iPhone, iPod touch and iPad are trademarks of Apple Inc., registered in the U.S. and other countries.

COPYRIGHT © 2023 OUT OF THE PARK DEVELOPMENTS. ALL RIGHTS RESERVED.

 

Powered by vBulletin® Version 3.8.10
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright © 2024 Out of the Park Developments