Home > database >  Oracle orader group, a very, very slow!
Oracle orader group, a very, very slow!

Time:10-20

Oracle directly according to the time the query need only 0.06 s, if the order by time after need 60 s

Database has been running for one year, are normal before

Online query said could be TEMP space is full, there is no effect after compression, database log file without error, ask the great spirit guide

CodePudding user response:

Group by, order by, return all of the data is needed to group or sort (there are exceptions, such as after the order by the paging may not need), according to the time period you query, because the client makes liberal give you did not return all of the data, so fast,

CodePudding user response:

How many total data? Sorting index on the field?

CodePudding user response:

According to the total amount of more than three thousand ten thousand, sorting no indexes on the field, on the field with the index order grouping, too slow

CodePudding user response:

There is also a the same database, the same query conditions, quickly

CodePudding user response:

reference 4 floor obgnahs response:
there is a same database, the same query conditions, fast


This library and slow library, the same amount of data? Meet the conditions of time the amount of data are consistent?

If is, then tools to assist in the investigation:
In your SQL join gather_plan_statistics prompts, such as: the select/* + gather_plan_statistics */...
Perform your SQL, and then run the following commands the results post:
Select * from table (dbms_xplan display_cursor (null, null, 'the last allstats'));
Pay attention to the execution of your SQL, to execute the above command, cannot perform any other SQL, in addition, do not use PLSQL developer, because the tool will perform some implied command, affect the output,

CodePudding user response:

In addition, the tuning time unless you for oracle optimizer and architecture is more understanding, it is best not to compare different libraries do, it will complicate, influence you to solve the problem,

CodePudding user response:

Novice, a great god guide

SQL> Select * from table (dbms_xplan display_cursor (null, null, 'the last allstats'));


PLAN_TABLE_OUTPUT
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

2 s422sp3b1fjg SQL_ID, child number 0
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The select/* + gather_plan_statistics */* from thunder2019 where
Datetime> 15:00:00 to_Date (' 2019-10-16 ', '- dd yyyy - mm hh24: mi: ss') order
By a datetime desc

Plan the hash value: 2282267311

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --


PLAN_TABLE_OUTPUT
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

| | Id Operation | Name | Starts | E - Rows | A - Rows | A - Time
Mem | Buffers | Reads | OMem | 1 | 2 - Mem |

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

| | 0 SELECT STATEMENT | | 1 | | | 0 00:00:30. 90

| | 486 k, 486 k | | | |

| | 1 SORT ORDER BY | | 1 | 5397 | | 0 00:00:30. 90

| | 486 k, 486 k | 1024 | 1024 | |

PLAN_TABLE_OUTPUT
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --


2 | | * TABLE ACCESS FULL | THUNDER2019 | 1 | 5397 | | 0 00:00:30. 90

| | 486 k, 486 k | | | |

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --


The Predicate Information (identified by operation id) :
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --


PLAN_TABLE_OUTPUT
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

2 - filter (" DATETIME "& gt; 15:00:00 TO_DATE (' 2019-10-16 ', 'syyyy - mm - dd hh24: mi: ss

'))


Note
-- -- -- -- --
- dynamic from 2 for this statement (level=2)


Selected 25 lines,

CodePudding user response:

From the point of the implementation plan, this is purely a datetime field no index, create an index on the field,,,

CodePudding user response:

refer to the eighth floor minsic78 response:
from the point of the implementation plan, this is purely a datetime field no index, create an index on the field,,,


Said the other, here you choose time is to get the condition of data after 15:00 today, if this time the premise condition, do you want to get a month, or even a year of data, then the index may not solve the problem your performance,

CodePudding user response:

Thank you for your guidance! Add the sorting efficiency improvement of indexes much time!

CodePudding user response:

The
references to the tenth floor obgnahs response:
thank you for your guidance! Add the sorting efficiency improvement of indexes much time!


That was not the sorting problem, is the issue of filter conditions,,,

CodePudding user response:

1, it is recommended that the optimization question, provide the SQL statement and corresponding implementation plan, in this way, you can be clear at a glance,
  • Related