SQL command ok to add?

PostgreSQL is the database server used to store information. Do you have a question or are you having problem with PostgreSQL? If so, post them here.

Moderator: Moderators

SQL command ok to add?

Postby js2002 » Mon Aug 23, 2010 1:09 pm

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?
js2002
 
Posts: 1501
Joined: Fri Feb 15, 2008 5:44 am
Location: Germany

Re: SQL command ok to add?

Postby kraada » Mon Aug 23, 2010 1:24 pm

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.
kraada
Moderator
 
Posts: 54431
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: SQL command ok to add?

Postby js2002 » Mon Aug 23, 2010 1:29 pm

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?
js2002
 
Posts: 1501
Joined: Fri Feb 15, 2008 5:44 am
Location: Germany

Re: SQL command ok to add?

Postby kraada » Mon Aug 23, 2010 2:40 pm

After adding the index you'll want the query planner to know it's there - it won't unless you run ANALYZE.
kraada
Moderator
 
Posts: 54431
Joined: Wed Mar 05, 2008 2:32 am
Location: NY


Return to PostgreSQL [Read Only]

Who is online

Users browsing this forum: No registered users and 19 guests

cron