sql - is there something faster than "having count" for large tables? -
Here's my query:
Choose the word_ID, sentence (sentence_id) from sentence_word group Having the word_id (sentence_id) & gt; 100; In table syntax, there is 3 fields, verdig, syntax and a primary key ID. This contains 350k + rows. This query takes a very large 85 seconds and I'm thinking (hopefully , Praying?) Is a fast way to find all the words, in which there are more than 100 ornaments.
I have tried to select the part count, and just 'counting (1)', but neither does it speed up.
Thank you!
counting (sentence_id)> 100;
There is a problem ... either the duplicate word / sentence has been added in the table, or it is not.
If it has duplicate words / phrases added to you, you should use this code to get the correct answer:
hosting hosting (different Sentence_ID)> gt; ; 100 If the duplicate words / sentences are not added to the table ... then you should not make a mistake, you should just calculate the rows.
Hosting COUNT (*)> 100 In that case, you can create an index on word_id , for optimal performance.
Comments
Post a Comment