Srimad Bhagavatam Canto 10, Chapter 12, Text 28

SB 10.12.28

krtyam kim atrasya khalasya jivanam
na va amisam ca satam vihimsanam
dvayam katham syad iti samvicintya
jñatvavisat tundam asesa-drg gharih
 
Translation by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
 
Now, what was to be done? How could both the killing of this demon and the saving of the devotees be performed simultaneously? Krsna, being unlimitedly potent, decided to wait for an intelligent means by which He could simultaneously save the boys and kill the demon. Then He entered the mouth of Aghasura.
 
Purport by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
 
Krsna is known as ananta-virya-sarvajña because everything is known to Him. Because He knows everything perfectly well, it was not difficult for Him to find a means by which He could save the boys and at the same time kill the demon. Thus He also decided to enter the demon’s mouth.
 
Srimad Bhagavatam Canto 10, Chapter 12, Text 27
Srimad Bhagavatam Canto 10, Chapter 12, Text 30