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 6798191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:42:02+00:00 2026-05-26T18:42:02+00:00

I am learning about all things SQL, and upon reading about indexes I naturally

  • 0

I am learning about all things SQL, and upon reading about indexes I naturally wanted to create a simple adhoc test to see how indexes REALLY affect performance (rather than just taking the reading at face value). However, I am having some big problems with the tests I was trying to set up. In short, no matter how big I make my tables, with or without indexes, the queries finish very quickly, on average 0.5 seconds every time. I was hoping that I could create some tables so large that certain queries would take a long time to execute, and then by creating indexes I could reduce those execution times, and compare the reductions against different types of indexes. However, I am having no luck at all! Here is how I set up my sample table:

CREATE TABLE EMPLOYEE
(EmpID  NUMBER(6),
Lname VARCHAR2(20),
Fname VARCHAR2(20),
Gender CHAR(1),
HomeState CHAR(2),
BirthDate DATE,
HiredDate DATE,
Occupation VARCHAR2(20),
Salary NUMBER(6),
NumDep NUMBER(1));

The EMPLOYEE table has 10 attributes, and I created a separate Java program to make SQL commands to populate the table with random info. For example, here is the output from the Java program with an input size of 3:

INSERT INTO EMPLOYEE VALUES (1, 'HENRY', 'VIRGINIA', 'F', 'MA', '14-NOV-1966', '27-APR-1987', 'MANAGER', '80514', '5');
INSERT INTO EMPLOYEE VALUES (2, 'PARSONS', 'KEVIN', 'M', 'KS', '11-DEC-1961', '14-JAN-2004', 'NURSE', '74416', '3');
INSERT INTO EMPLOYEE VALUES (3, 'GARRETT', 'JIMMY', 'M', 'NE', '24-MAR-1963', '20-MAY-1992', 'SERVICE', '87116', '2');

The last name is chosen from 500 common last names randomly.
The first name is chosen from 100 gender-specific first names randomly.
The state is chosen randomly (from a list of 50, obviously).
The dates are chosen randomly within certain reasonable limits.
The occupation is chosen randomly from a list of 20 common jobs.
The salary is chosen randomly between 50000 and 99999 (which leads to some unrealistic salary/job matches, but that is not really the point here).
The number of dependents is chosen randomly between 0 and 5.

I figured that one good thing about the above setup is the range of domain sizes. I.e. 500 last names possible, 100 first names possible, 50 states, 20 jobs, etc. I know from reading that indexes work better when the amount of possible values is smaller compared to the overall number of records, and I was hoping to be able to prove this with my testing. However, as I said before, my testing is failing horrible.

I started off populating the EMPLOYEE table with only 500 records, and found that every query I did (example below) took only 0.5 seconds in SQL Developer (the software I am using to connect to Oracle 11g).

SELECT * FROM EMPLOYEE WHERE salary BETWEEN 60000 and 62000;

So then I tried with 1,000 records, then 10,000 records, then 100,000 records, then 500,000 records (which I had to insert in batches of 100,000 since my clipboard and/or SQL Developer can’t seem to handle such large script)… and the results are still the same. It solves every query in 0.5 seconds! Which blows my mind since it takes over 60 seconds to insert 100,000 records. Also SQL Developer can’t seem to return more than 5,000 results in a single query script execution, and if I come close to this max sometimes it takes 1.0 seconds instead of 0.5 seconds, but I suspect this is mainly because of the time needed to print all 5,000 results in the script output window.

I have tried my queries on various attributes, and I’ve tried with and without indexes on those attributes, and the indexes seem to make no difference. I am very disappointed here. I was expecting my testing to yield much more tangible results. I was also hoping to use this topic, along with the results of this testing for a class paper that I need to write soon, but with my testing yielding no results that is going to be kind of hard. Any suggestions?

P.S. Thanks for reading this far if you did! Really sorry for the length…

  • 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-26T18:42:02+00:00Added an answer on May 26, 2026 at 6:42 pm

    If you’re doing SELECT *, Oracle is basically going to have to retrieve all the blocks for your table no matter what, so it’s very possible that it’s not using your index. To determine if it’s using your index, you need to look at the explain plan or the execution plan. That will tell you what route Oracle chose to get your data, a full table scan, an index scan, etc.

    Here’s some documentation on using EXPLAIN PLAN in 10g.

    As for the times in SQL Dev, once Oracle has read all the data blocks for the table, it holds them in cache for a while. That’s part of the IO that often takes the longest. The 5000 limit in SQL Dev can be set somewhere in the options, but I forget where.

    You might be better off doing this in SQL*Plus, and setting AUTOTRACE to on. You can get a record of the actual IO calls that way. Look for “db block gets” and “consistent gets”, I think.

    Really, without an execution plan or an explain plan to tell us what Oracle is really doing to get your data, it’s hard to tell if it’s even using your indexes.

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

Sidebar

Related Questions

I'm learning about table design in SQL and I'm wonder how to create a
Just learning about sql joins and things, and I have a question. Can you
I'm learning about WCF Web Services and I'm concerned about all of the coupling
I am just learning about LINQ to XML in all its glory and frailty,
I keep hearing all these things about how awesome jQuery is and how the
I'm learning about software engineering and design right now, and after reading some books
When I first started learning about Spring, things were configured in the applicationContext.xml file.
I was just reading about Linq to SQL being discontinued. For a while I
After learning about the Action delegate in C# I've been looking for ways I
I remember first learning about vectors in the STL and after some time, I

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.