|
MS SQL Stored procedure templates |
Over the course of working with one employer, I headed up an investigation into our current server performance, and how would could potentially aim for at least a 25% to 30% increase on our current user thresholds before our capacity maxed out.
After looking through a series of server logs, and data transactions it was easy to see that the server technology being used, Coldfusion, is not the most efficient data handler in the world.
So after stripping back our application layer, taking a peek under the hood, and changing around 600 or so instances of data connectivity from inline SQL code, to Stored Procedures, we had more than exceeded our target gain. In fact under stress testing we had achieved a consistent increase of around 65% threshold. As a quick set of figures, the server loads had changed from CF, running at 75%-80% dropping to 20%-25%, and SQL server running at 6% increased to around 15%.
Based on these figures, and architectural methodologies I've learnt since, I would always recommend stored procedures over inline SQL code. This has lead me to develop a standard set of SQL templates for developers to use.
They are self checking, repeatable SQL templates that will action the desired changes, and check for any existing conditions up front. The idea is that a non technical resource could run them, and receive a useable English response.
1. Select statement
2.
Update Statement
3. Insert statement
4.
Delete statement
|
Differences between cfQueryParam "cf_sql_date" and "cf_sql_timestamp" |
I was recently looking at a report generator, and came across a conflict in the mySql query dealing with the date objects.
The report returns a set of records between two dates, using cfqueryparam, but there seemed to be a problem in running the query using certain dates.
Running it from a browser provided differing results from running it directly in a sql interface. So where was the error?
The original code was using the "cf_sql_date" type to pass the date time off to the sql engine. It appears that this data type is not transferred as a date time value, but as an incompatible numeric value, that is not comparable to the mySql datetime I am querying against.
2
3AND table.ap_enddate <= <cfqueryparam cfsqltype="CF_SQL_DATE" value="#createodbcdate(arguments.rangeto)#">
There are a wealth of articles online about passing date values into a variety of database technologies, but this Adobe post was very helpful.
This article shows a handy table of cfsqltypes and how they map to different database management systems.
Using something like sql profiler you can clearly see the difference between cf_sql_date and cf_sql_timestamp, where cf_sql_date is being truncated to just a date value (actually evaluates as a numeric value) and a full date time stamp that cf_sql_timestamp generates.
2
3AND table.ap_enddate <= <cfqueryparam cfsqltype="cf_sql_timestamp" value="#createodbcdate(arguments.rangeto)#">
Changing the code to the above example completely resolves this issue.
|
Scrolling Div areas, using overflow:auto |
2 #ScrollDiv {width:275px;height:130px;overflow: auto; background-color: #E3E1DD;
3 border-color: #CCCCCC #666666 #666666 #CCCCCC;
4 border: 1px solid;}
5</style>
Suspendisse neque. Nunc urna nisl, varius eget, placerat vitae, mollis in, nisl. Praesent interdum. Duis tempus ligula ut ipsum. Sed dictum massa sit amet tortor. Nulla hendrerit mi a felis. Morbi auctor mauris id lorem. Cras ac magna. Aliquam erat volutpat. Phasellus sed felis. Nunc auctor, est vel adipiscing eleifend, purus tortor pellentesque lacus, sit amet mattis nisi lorem eget quam. Donec dignissim eros dignissim urna. In dolor. Nulla lacus enim, interdum at, interdum vel, faucibus vel, dui. Proin fringilla nisi quis tellus. Integer magna. Aenean iaculis. Ut lacus massa, fermentum dictum, ornare ut, malesuada sed, mauris. Nullam viverra sapien aliquam ligula. Fusce arcu quam, vehicula vel, iaculis at, sagittis eu, enim.
Duis aliquet ornare magna. Nullam pede risus, porttitor at, imperdiet a, gravida at, pede. Maecenas purus magna, cursus eget, sagittis non, elementum vitae, dolor. Integer congue, massa quis pulvinar posuere, nisi neque rutrum justo, ut tincidunt ante felis ut orci. Phasellus venenatis lobortis tellus. Donec mollis felis tristique dolor. Duis molestie porttitor ipsum. Maecenas magna diam, malesuada ut, aliquam quis, mattis at, massa. Nullam quis ante vel enim mollis dictum. Aenean sollicitudin quam non neque. Nam turpis. Vivamus sed lectus. Sed ligula. Etiam at nibh. Aliquam nec lectus eget pede auctor consectetur.
Text thanks to http://www.lipsum.com/
|
Amazon's Public Webservices top 1TB of public data |
Thats right, Amazon.com's publicly available data sets have just topped 1TB!
These are free (must register) open webservice datasets, that you can use as you see fit.
The data has a distinctly American feel to it, but as the systems grows I'm sure it will become more international.
Puts a new slant on hosting data-less solutions.