Jump to content
php.lv forumi

Mysql izvēlās neefektīvus izpildes ceļus.


codez

Recommended Posts

  • Replies 36
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Ja dala pa grupām, tad pa tabulām nevajag dalīt. Uzliek vēl vienu parametru - subgroup un uztaisa indeksu subgroup,id un tad atlasa


SELECT * FROM test WHERE subgroup=123 ORDER BY id 5000,10

Attiecīgi, viņš where atradīs, izmantojot indeksu un tikai no tās vietas sāks fullscanu uz 5010 rindām.
Link to comment
Share on other sites

Ja reāli ir nepieciešama veiktspēja un servera atmiņa ir jāiet uz partitioning , pēdējais rezultāts bija 350% ātrdarbība pie pareiziem predicatiem un pareizi saparticionētiem indexiem papildus ja db ir hiarhiski pareizi un korektiem datiem bērnu tabulas pēc references un uz join būs vēl papildus efektivitāte , ja datus izmantojam tikai selectam vēl saarhivējam atsevišķās partīcijas un iegūstam vērtīgo atmiņas sektoru.  

 

Tikai ieteiktu atcerēties  partitioning can save you or kill you !

Edited by zuks
Link to comment
Share on other sites

Pašreiz tiek nobeigts 

select * from table(dbms_xplan.display);

Plan hash value: 675508361
 
----------------------------------------------------------------------------------------------
| Id  | Operation         | Name                     | Rows  | Bytes | Cost (%CPU)| Time     |
----------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |                          |  1325K|   734M|   631K  (3)| 00:25:25 |
|*  1 |  TABLE ACCESS FULL| ***************** |  1325K|   734M|   631K  (3)| 00:25:25 |
----------------------------------------------------------------------------------------------

 

Rezultāts 

select * from table(dbms_xplan.display);


Plan hash value: 1163575294
 
--------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                           | Name                     | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
--------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                    |                          |  5256K|    21G| 17021   (1)| 00:00:42 |       |       |
|   1 |  PARTITION LIST SINGLE              |                          |  5256K|    21G| 17021   (1)| 00:00:42 |   KEY |   KEY |
|   2 |   PARTITION RANGE SINGLE            |                          |  5256K|    21G| 17021   (1)| 00:00:42 |     3 |     3 |
|*  3 |    TABLE ACCESS BY LOCAL INDEX ROWID| ************************ |  5256K|    21G| 17021   (1)| 00:00:42 |     3 |     3 |
|*  4 |     INDEX RANGE SCAN                | ******************       |    11M|       | 16361   (1)| 00:00:40 |     3 |     3 |
--------------------------------------------------------------------------------------------------------------------------------
 
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...