Background
Note: Running database scripts that update data against your DotNetNuke database is not a recommended practice. DotNetNuke maintains binary compatibility at the API level but does not do so at the database level, so any script ran against the database can potentially fail (as the database has changed) or runs the risk of updating data in a fashion that is inconsistent with the DotNetNuke API e.g. perhaps a core API function when ran updates data in 2 places, but direct SQL only updates it in 1. This can mean that the database loses data integrity or in the worst case may end up creating invalid data that causes your site to crash/work incorrectly/fail during an upgrade.
Use the following scripts at your own risk!Clean up unused items
TRUNCATE TABLE {databaseOwner}{objectQualifier}EventLog
GO
TRUNCATE TABLE {databaseOwner}{objectQualifier}ScheduleHistory
GO
TRUNCATE TABLE {databaseOwner}{objectQualifier}SiteLog
GO
TRUNCATE TABLE {databaseOwner}{objectQualifier}SearchItemWordPosition
GO
DELETE FROM {databaseOwner}{objectQualifier}SearchItemWord
GO
DELETE FROM {databaseOwner}{objectQualifier}SearchWord
GO
DELETE FROM {databaseOwner}{objectQualifier}SearchItem
GO
Note: Other
Performance best practices can be read on this wiki.
Find and fix scripts
The following are some scripts that can be used to fix invalid data (created under certain conditions). As these directly update data, please back your database up first.
Other script ideas