Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6946967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:37:59+00:00 2026-05-27T13:37:59+00:00

when I create an index on a db2, for example with the following code:

  • 0

when I create an index on a db2, for example with the following code:

CREATE INDEX T_IDX ON T(
A,
B)

is it a composite index?
if not: how can I then create a composite index?
if yes: in order to have two different index should I create them separately as:

CREATE INDEX T1_IDX ON T(A)
CREATE INDEX T2_IDX ON T(A)

EDIT: this discussion is not going in the direction I expect (but in a better one :)) I actually asked how, and not why to create separate indexes, I planed to do that in a different question, but since you anticipated me:

suppose I have a table T(A,B,C) and a search function search() that select from the table using any of the following method

WHERE A = x
WHERE B = x
WHERE C = x
WHERE A = x AND B=y (and so on AC, CB, ABC)

if I create a compose index ABC, is it going to working for example when I select on just C?
the table is quite big, and the insert\update not so frequent

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:38:00+00:00Added an answer on May 27, 2026 at 1:38 pm

    Yep multiple fields on create index = composite by definition: Specify two or more column names to create a composite index.

    Understanding when to use composite indexes appears to be your last question…

    If all columns selected by a query are in a composite index, then the dbengine can return these values from the index without accessing the table. so you have faster seek time.

    However if one or the other are used in queries, then creating individual indexes will serve you best. It depends on the types of queries executed and what values they contain/filter/join.

    If you sometimes have one, the other, or both, then creating all 3 indexes is a possibility as well. But keep in mind each additional index increases the amount of time it takes to insert, update or delete, so on highly maintained tables, more indexes are generally bad since the overhead to maintain the indexes effects performance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table t1 and two indexes: create index if not exists timeindex
create unique index In DB2 UDB I can create an index using the following
I need to create index from two tables that are not related. But when
Similar to SQLServer where I can do the following create index TimeSeriesPeriodSs1 on TimeSeriesPeriod
An index on two columns can be created with either of the statements create
Given the following indexes for an Oracle database: CREATE INDEX subject_x1 ON subject (code);
I have created an index on my table like this: CREATE INDEX index_typ_poplatky ON
I encountered the following ddl in a pl/sql script this morning: create index genuser.idx$$_0bdd0011
Can someone help me create an index/count button for a UITableView, like this one?
Would the following SQL statement automatically create an index on Table1.Table1Column, or must one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.