Yes, you are right, when you define a primary key an index is created. If you does the query in the same order, the primary's key index is used. By example: - username, title ---> uses the primary's key index - title, start_date ---> don't use the primarys key index, because it has not a "username" column - title, start_date, username ---> don't use the primary's key index because the column "username" is not the first column.
Greetings. Walter. On Sun, Sep 11, 2011 at 2:17 PM, firebirdsql <[email protected]> wrote: > ** > > > If I a tables primary key is (username, title, start_date)...I'm guessing > it > will create an index on (username, title, start_date). > > If I'm querying by username, start_date, will it still use the index OR do > I > need to add an extra index for username, start_date)? > > > [Non-text portions of this message have been removed] ------------------------------------ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Visit http://www.firebirdsql.org and click the Resources item on the main (top) menu. Try Knowledgebase and FAQ links ! Also search the knowledgebases at http://www.ibphoenix.com ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
