T
T
Toopie2018-04-26 04:43:01
MySQL
Toopie, 2018-04-26 04:43:01

It seems I killed MySQL?

Good morning.
I decided to make a test database with 500k rows.
Structure:
[id | post_id | text | time]
post_id - number in the for loop ($i = 0; $i < 1000000; $i++)
time - time() function; in PHP
I make a request: SELECT * FROM `test`;- result:

....................*тут предыдущие строчки*....................
| 579777 |  579776 | text | 1524706021 |
| 579778 |  579777 | text | 1524706021 |
| 579779 |  579778 | text | 1524706021 |
| 579780 |  579779 | text | 1524706021 |
| 579781 |  579780 | text | 1524706021 |
| 579782 |  579781 | text | 1524706021 |
| 579783 |  579782 | text | 1524706021 |
| 579784 |  579783 | text | 1524706021 |
| 579785 |  579784 | text | 1524706021 |
| 579786 |  579785 | text | 1524706021 |
| 579787 |  579786 | text | 1524706021 |
| 579788 |  579787 | text | 1524706021 |
| 579789 |  579788 | text | 1524706021 |
| 579790 |  579789 | text | 1524706021 |
| 579791 |  579790 | text | 1524706021 |
| 579792 |  579791 | text | 1524706021 |
| 579793 |  579792 | text | 1524706021 |
| 579794 |  579793 | text | 1524706021 |
| 579795 |  579794 | text | 1524706021 |
| 579796 |  579795 | text | 1524706021 |
| 579797 |  579796 | text | 1524706021 |
| 579798 |  579797 | text | 1524706021 |
| 579799 |  579798 | text | 1524706021 |
| 579800 |  579799 | text | 1524706021 |
| 579801 |  579800 | text | 1524706021 |
| 579802 |  579801 | text | 1524706021 |
| 579803 |  579802 | text | 1524706021 |
| 579804 |  579803 | text | 1524706021 |
| 579805 |  579804 | text | 1524706021 |
| 579806 |  579805 | text | 1524706021 |
| 579807 |  579806 | text | 1524706021 |
| 579808 |  579807 | text | 1524706021 |
| 579809 |  579808 | text | 1524706021 |
| 579810 |  579809 | text | 1524706021 |
| 579811 |  579810 | text | 1524706021 |
+--------+---------+------+------------+
579811 rows in set (38.90 sec)

I make a request:
SELECT * FROM `test` WHERE `post_id`>1 AND `post_id`<100
- result:
|  84 |      83 | text | 1524705788 |
|  85 |      84 | text | 1524705788 |
|  86 |      85 | text | 1524705788 |
|  87 |      86 | text | 1524705788 |
|  88 |      87 | text | 1524705788 |
|  89 |      88 | text | 1524705788 |
|  90 |      89 | text | 1524705788 |
|  91 |      90 | text | 1524705788 |
|  92 |      91 | text | 1524705788 |
|  93 |      92 | text | 1524705788 |
|  94 |      93 | text | 1524705788 |
|  95 |      94 | text | 1524705788 |
|  96 |      95 | text | 1524705788 |
|  97 |      96 | text | 1524705788 |
|  98 |      97 | text | 1524705788 |
|  99 |      98 | text | 1524705788 |
| 100 |      99 | text | 1524705788 |
+-----+---------+------+------------+
98 rows in set (27.52 sec)

That seems like a lot to me for outputting 100 rows, how can MySQL itself be optimized? (worth MYISAM)
Parameters:
1CPUx2400MHz
512MB RAM
10GB SSD

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Immortal_pony, 2018-04-26
@Immortal_pony

Add an index

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question