Avatar of NiceMan331
NiceMan331

asked on 

how to reduce query time for un indexed table

hi
we purchased POS , where they provided a solution that daily basis every point of sales will send its data as text file
then to append it all into one table where it is un indexed and have too large records til now , and every day it is increase day by day
i don't like to touch the table , but when i do any query it takes minimum 30 minutes to finish
how i do to reduce time of query ?
Oracle Database

Avatar of undefined
Last Comment
slightwv (䄆 Netminder)
Avatar of MikeOM_DBA
MikeOM_DBA
Flag of United States of America image

Create indexes.
SOLUTION
Avatar of David VanZandt
David VanZandt
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of NiceMan331
NiceMan331

ASKER

Thanx dvz for explanation , but first I cannot do any modification to the table , second , when I query , it is not necessary to query the new records only , I might need some data in the middle , or let me say , I can set fixed creteria to my search from that big table I always need to search within fixed specicifi records , any su to do it ?
SOLUTION
Avatar of MikeOM_DBA
MikeOM_DBA
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of David VanZandt
David VanZandt
Flag of United States of America image

Nice, this thread brings up many of the better ways to improve query performance, as you requested.  You cannot modify the table, which I presume to include you cannot affect indexes, block storage, partitioning, materialized views, nor partial data sets.  The table increases daily, but is not purged of old data.  The status of the table, schema, and system statistics are unknown, and their refresh, if any, may not be compensating for the volatility.

In short, you're stuck.

What is your role if you cannot modify the architecture, and what is your relationship to those who can?
ASKER CERTIFIED SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of NiceMan331
NiceMan331

ASKER

thanx again
actually , the company proffessions only in the pos solution , but when we asked them about head quarter data analyses , they provides this solution only , i mean to upload the data set from text file to the oracle table
and they also provided a solution for data analyses ( analyses tools similiar to excell sheet ) based on copied tables
i understood the process they dod like this :
they upload daily data into many tables
full data to the main table mensioned in my question which become very large
and specific fields only uploaded in same time to another tables ( smaller size , easy to run , fast to query)
those tables were the base of the data anlyses solution they provided by them , but for me it is not enough , i require additional fields for expended analyse .
anyhow now the question is : if i want to use always fixed specific creteria with full fields from the main table , any way to do it ?
thanx
Avatar of NiceMan331
NiceMan331

ASKER

mike
Create materialized view (or index-organized table) with the criteria you wish to query and re-build it daily?
is it normal view , or special craeted ?

If you cannot do any modification to the table, get someone that can and tell him/her about the issue
i can , but i don't like to do because no body knows that i'm using database tables
>>is it normal view , or special craeted ?

Normal views store a query and when you select from the view, the stored query is executed.  A Materialized View (MV) executes the query and stores the results as a regular table.  The MV gets refreshed as the base tables change.  When and how often depends on how you set up the MV.

The online docs will tell you everything you want to know about them.

>>but i don't like to do because no body knows that i'm using database tables

This can get you fired or even arrested pretty quick if you are accessing data you are not supposed to be accessing.

>>if i want to use always fixed specific creteria with full fields from the main table , any way to do it ?

A MV will create a table based on whatever query you tell it to use so it may work for what you want.
Avatar of NiceMan331
NiceMan331

ASKER

ok , let me take a look for the MV , then i will be back to here
anyhow , let me say something
when i do
select * from mytable
it result it in less than second
but when i used single condition , it takes such like 30 minutes
i think this is because no index , right ?
thanx
>>select * from mytable it result it in less than second ... i think this is because no index , right ?

I think it is because of the tool you are using to run the query.  GUI tools like Toad and SQL Developer buffer start displaying rows as soon as it can.  It does not return ALL the rows at once so it may appear the query executes fast when it just returns the first few rows fast.

Run it in sqlplus and wait for the entire thing to return:
SQL> set timing on
SQL> select * from mytable;

Then wait...  setting timing on will tell you how long the query actually ran.
Avatar of NiceMan331
NiceMan331

ASKER

SELECT WITH CONDITION result the following
real  828459
it takes exactly 13 minutes in sqlplus
same time in Toad
So what does the query do in sqlplus without the condition?  That is what you were supposed to test since you stated "select * from mytable it result it in less than second".

I was wanting to see it your 'fast' results were due to Toad buffering the results.
Avatar of NiceMan331
NiceMan331

ASKER

So what does the query do in sqlplus without the condition
withour condition it takes more than 35 minutes as per the big of data
>>withour condition it takes more than 35 minutes as per the big of data

That is what I would expect not the "less than second" you mentioned above.

Anyway, the question has been answered:
Add indexes, change to partitioning or add hardware.
Oracle Database
Oracle Database

Oracle is an object-relational database management system. It supports a large number of languages and application development frameworks. Its primary languages are SQL, PL/SQL and Java, but it also includes support for C and C++. Oracle also has its own enterprise modules and application server software.

81K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo