Deleting all entries from a Section
Records are definitely not the way to go with dealing with large amounts of data sets in the database.  There is just too much overheard associated with them.

Manually running SQL (as you've discovered) is an option, but if you wanted to do this from PHP, you could still use QueryBuilder.

$elementIds = craft()-&gt;db-&gt;createCommand()
            -&gt;select('id')
            -&gt;from('entries')
            -&gt;where('sectionId = :sectionId', array(':sectionId' =&gt; 18))
            -&gt;queryColumn();

$rowsAffected = craft()-&gt;db-&gt;createCommand()
            -&gt;delete(
                'elements',
                array('in', 'id', $elementIds)
             );


The MySQL cascading deletes setup on the foreign keys should take care of cleaning up the necessary rows in the remaining tables automatically.