Page 1 of 1

SQL command ok to add?

PostPosted: Mon Aug 23, 2010 1:09 pm
by js2002
CREATE INDEX IDX_holdem_hand_player_statistics_id_player_real
on holdem_hand_player_statistics (id_player_real);

Is this command ok for the DB?
My tool searches with "where id_player_real = ..." so this could speed up a lot.

Do I have to do more to gain performance?

Re: SQL command ok to add?

PostPosted: Mon Aug 23, 2010 1:24 pm
by kraada
That shouldn't cause any problems, but don't forget to ANALYZE after you create the index. We've optimized our indices for our own queries, I don't know what else might help you with your tool.

Re: SQL command ok to add?

PostPosted: Mon Aug 23, 2010 1:29 pm
by js2002
Mainly its just one query. We cant go over id_player because wie read the playername in the HH and so whe need id_player_real. (Do u know a "cheaper" way f.e. to go over the alias system of PT3?!)

why this analyis command?

Re: SQL command ok to add?

PostPosted: Mon Aug 23, 2010 2:40 pm
by kraada
After adding the index you'll want the query planner to know it's there - it won't unless you run ANALYZE.