We create several crystal reports based on SQL Server – usually 2005 or 2008. Broadly there are 2 kind of reports
a) tabular reports – which shows some data in a table (for example, invoice list)
b) document layouts – which shows data in specific format – usually from one or two main tables – and several secondary tables (for example, invoice)
We sometimes use tables directly in crystal. Or create a procedure in SQL and than use that procedure. One invoice could refer to usually around 10-12 tables. Most of these linked using left outer join to the primary invoice table.
What option is better – using tables in crystal (and let crystal create and run the sql query) – or create a query – and than use that query in crystal. Which one will give better performance?
There will be no difference in performance between a query generated by the ‘Database Expert’ versus the same SQL added to a Command. One caveat: ensure that the record-selection formula can be parsed and sent to the database (a filter applied
WhileReadingRecordswill definitely be less efficient that a pure-SQL one).Reasons to prefer the ‘Database Expert’:
Reasons to prefer a Command:
Personally, I try to avoid stored procedures as they offer minimal performance benefits, but require a more-signification investment in development and maintenance.
In the end, there is no substitute for performance. Try you query both ways and measure the results.