Changeset - de0a4653463b
[Not reviewed]
default
0 1 0
Laman - 7 years ago 2018-05-14 15:06:58

optimalizace: index na jménech hráčů
1 file changed with 1 insertions and 0 deletions:
egd.py
1
0 comments (0 inline, 0 general)
egd.py
Show inline comments
 
@@ -63,24 +63,25 @@ def setupDB():
 
	cursor.execute("""create table players_performance (pin integer references players(pin), tournament_code text references tournaments(code), country_code text, club text, win_count integer, game_count integer, rating_before real, rating_after real, primary key (pin,tournament_code))""")
 

	
 
	cursor.execute("""
 
		create view players_performance_tournaments (pin,p_country_code,rating_before,rating_after,t_country_code,datum) as
 
			select pin,pp.country_code,rating_before,rating_after,ts.country_code,datum
 
				from players_performance as pp join tournaments as ts on pp.tournament_code=ts.code
 
	""")
 

	
 
	cursor.execute("""create index pp_pin on players_performance (pin)""")
 
	cursor.execute("""create index pp_tournament_code on players_performance (tournament_code)""")
 
	cursor.execute("""create index pp_country_ind on players_performance (country_code)""")
 
	cursor.execute("""create index t_datum_ind on tournaments (datum)""")
 
	cursor.execute("""create index p_name_ind on players (name)""")
 

	
 
	connection.commit()
 

	
 

	
 
def fillDB(tournaments,players):
 
	cursor=connection.cursor()
 

	
 
	cursor.execute("""delete from players_performance""")
 
	cursor.execute("""delete from players""")
 
	cursor.execute("""delete from tournaments""")
 

	
 
	cursor.executemany(
0 comments (0 inline, 0 general)