Forums Register Login

Regarding Database Index

+Pie Number of slices to send: Send
Does creating a table automatically creates index on the column.
I mean if I will create a table
create table.....(id, name)
Will this automatically be indexed on id and name ?
+Pie Number of slices to send: Send
No. Nor should it be. Indices incur a decrease in insert/update/delete performance so you wouldn't want them added by default.

Some database s (such as SQL Server) will automatically create indices on columns that are foreign keys. Other than that by and large its up to you to choose what to index.
+Pie Number of slices to send: Send
Priyakant,
Many databases automatically create an index on the primary key (likely id in your example.)

There would be no point in creating an index on all the columns in the table - automatically or manually. The reason is that such an index would be just as large as the source table. Which means it would take just as long to scan as the table.
+Pie Number of slices to send: Send
Thanks alot for the promt replies
Because those who mind don't matter and those who matter don't mind - Seuss. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1241 times.
Similar Threads
HSQLDB Text Table Performance
JPA (TopLink) DB2 table generation
Does Oracle automatically create a unique index for PK ?
How to automate insert statement using hibernate config file
Dynamic text fields gives java.lang.IndexOutOfBoundsException
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 10:22:03.