<p>A Windows Forms application of ours pulls records from a view on SQL Server through ADO.NET and a SOAP web service, displaying them in a data grid. We have had several cases with ~25,000 rows, which works relatively smoothly, but a potential customer needs to have many times that much in a single list.</p>

<p>To figure out how well we scale right now, and how (and how far) we can realistically improve, I'd like to implement a simulation: instead of displaying actual data, have the SQL Server send fictional, random data. The client and transport side would be mostly the same; the view (or at least the underlying table) would of course work differently. The user specifies the amount of fictional rows (e.g. 100,000).</p>

<p>For the time being, I just want to know how long it takes for the client to retrieve and process the data and is just about ready to display it.</p>

<p>What I'm trying to figure out is this: how do I make the SQL Server send such data?</p>

<p>Do I:</p>

<ol>
<li>Create a stored procedure that has to be run beforehand to fill an actual table?</li>
<li>Create a function that I point the view to, thus having the server generate the data 'live'?</li>
<li>Somehow replicate and/or randomize existing data?</li>
</ol>

<p>The first option sounds to me like it would yield the results closest to the real world. Because the data is actually 'physically there', the <code>SELECT</code> query would be quite similar performance-wise to one on real data. However, it taxes the server with an otherwise meaningless operation. The fake data would also be backed up, as it would live in one and the same database — unless, of course, I delete the data after each benchmark run.</p>

<p>The second and third option tax the server <em>while</em> running the actual simulation, thus potentially giving unrealistically slow results.</p>

<hr>

<p>In addition, I'm unsure how to create those rows, short of using a loop or cursor. I can use <code>SELECT top &lt;n&gt; random1(), random2(), […] FROM foo</code> if <code>foo</code> actually happens to have <code>&lt;n&gt;</code> entries, but otherwise I'll (obviously) only get as many rows as <code>foo</code> happens to have. A <code>GROUP BY newid()</code> or similar doesn't appear to do the trick.</p>

[{'answer_id': 36996, 'author': 'Rob Walker', 'author_id': 3631, 'author_profile': 'https://Stackoverflow.com/users/3631', 'pm_score': 0, 'selected': False, 'text': "<p>If you want results you can rely on you need to make the testing scenario as realistic as possible, which makes option 1 by far your best bet.  As you point out if you get results that aren't good enough with the other options you won't be sure that it wasn't due to the different database behaviour.</p>\n\n<p>How you generate the data will depend to a large degree on the problem domain.  Can you take data sets from multiple customers and merge them into a single mega-dataset?  If the data is time series then maybe it can be duplicated over a different range. </p>\n"}, {'answer_id': 37004, 'author': 'Sören Kuklau', 'author_id': 1600, 'author_profile': 'https://Stackoverflow.com/users/1600', 'pm_score': 0, 'selected': False, 'text': "<p>The data is typically CRM-like, i.e. contacts, projects, etc. It would be fine to simply duplicate the data (e.g., if I only have 20,000 rows, I'll copy them five times to get my desired 100,000 rows). Merging, on the other hand, would only work if we never deploy the benchmarking tool publicly, for obvious privacy reasons (unless, of course, I apply a function to each column that renders the original data unintelligible beyond repair? Similar to a hashing function, only without modifying the value's size too much).</p>\n\n<p>To populate the rows, perhaps something like this would do:</p>\n\n<pre><code>WHILE (SELECT count(1) FROM benchmark) &lt; 100000\n  INSERT INTO benchmark\n  SELECT TOP 100000 * FROM actualData\n</code></pre>\n"}, {'answer_id': 194333, 'author': 'SqlACID', 'author_id': 19797, 'author_profile': 'https://Stackoverflow.com/users/19797', 'pm_score': 2, 'selected': False, 'text': '<p>For data for testing CRM type tables, I highly recommend <a href="http://www.fakenamegenerator.com" rel="nofollow noreferrer">fakenamegenerator.com</a>, you can get 40,000 fake names for free.</p>\n'}, {'answer_id': 215795, 'author': 'Brent Ozar', 'author_id': 26837, 'author_profile': 'https://Stackoverflow.com/users/26837', 'pm_score': 1, 'selected': False, 'text': '<p>You didn\'t mention if you\'re using SQL Server 2008.  If you use 2008 and you use Data Compression, be aware that random data will act very differently (slower) than real data.  Random data is much harder to compress.</p>\n\n<p>Quest Toad for SQL Server and Microsoft Visual Studio Data Dude both have test data generators that will put fake "real" data into records for you.</p>\n'}]
['https://Stackoverflow.com/questions/36956', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1600/']