After some investigations, I found that difference between the 1st and 2nd machine is that 1st is mysql 5.7.17 and second is 5.7.18. and there is a fix between them on count(*) performance.
So I knew that my tests on count(*) was wrong, to found a way a solution of my very slow query which uses 'select * ...'.
The table has already a primary key on id, so I added this :
create index treated_record on record (treated);
And my 'select * ...' works very quickly.
My questions now, is :
- do indexes pose risks on performances?
- could it be fatal if not uses correctly?
- how could I know If I do wrong or not on my index add choice?
- should I add more indexes depending on other queries I do in record table?
- how do you find my record table structure and volume of data? is it normal? should I do it on another way ?