Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

The SQL Server 2005 XML Temptress Expand / Collapse
Author
Message
Posted Monday, March 26, 2007 10:50 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Thursday, May 15, 2014 6:04 AM
Points: 91, Visits: 108

Did you experiment with SQL 2005's xml indexes?  I wonder if they could be used in the sample last name query of the view...

 

Post #353917
Posted Monday, March 26, 2007 11:36 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, September 23, 2010 2:07 AM
Points: 18, Visits: 34

Ken,
I accept your criticism of the use of boolean discriminator attributes.  There are other mechanisms (such as an IsInClass function using bitwise operators) that would allow for the implementation of richer classification mechanisms – but I thought that it would distract from the intention of the article.

The use of some other field, as opposed to an attribute within the xml fragment is redundant but is intended for some performance gain by not having to query the xml directly in order to retrieve the initial subset that you may be interested in and therefore I would avoid having classification structures contained solely within the xml itself.

Simon 

Post #353932
Posted Monday, March 26, 2007 11:48 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, September 23, 2010 2:07 AM
Points: 18, Visits: 34

Wanderer,
When it comes to accessing the database I am fairly anal about how developers access the database and tend to create an abstraction layer for developers that use more simple datatypes – regardless of how the data is being physically stored.  I don’t like the approach of developers arbitrarily creating their own database access – for reasons that go beyond datatypes – the best way to ensure that developers do not bring your database to its knees is to be ware of how the database is being accessed – although I understand that this is not possible in all environments.  I have experimented with xml schemas and find that SQL server implements them well but I haven’t had a need to put them into production – yet.  Perhaps once the schemas are cast in stone it is something that I would be obliged to do.  I would think that there would be a performance knock on inserts using schemas but queries and indexes may be faster – some investigations would be required on large data volumes to really understand the performance considerations.

Simon

 

Post #353939
Posted Monday, March 26, 2007 12:03 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, September 23, 2010 2:07 AM
Points: 18, Visits: 34

Mike,
I like the idea of indexes in xml datatypes, particularly when combined with schemas.  There was a comment in one of Steve’s editorial posts a few weeks ago that said something like “let databases do what they are good at – rows and columns” – this makes sense but a small feature such as indexes on xml raises the question “well what if SQL databases were good at xml too?”  I don’t know much about the internals of the database engine but I imagine that if the xml indexes were handled in the same way as ‘normal’ indexes that you could get similar performance – regardless of whether your index is on a field or an xml attribute.  So, if the query plan for a field looks the same as a query plan for xml, using index seeks, then surely we could argue that SQL databases are becoming good at handling not just rows and columns, but xml too?
My current implementations are tentative seductions by the xml temptress and although it appears that indexes on xml data do work, I haven’t taken the time yet to perform some real tests.

Simon

Post #353944
Posted Saturday, March 31, 2007 1:12 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, April 15, 2014 1:18 AM
Points: 2, Visits: 35

Very interresting article Simon, to be honest i am still in the position you had one year ago : never even think about it .

Here is a quick comment on Grant's strategy regarding feeding of amount of data .

But after a time, and that does vary, testing is required, the number of calls gets nasty. So instead, we pump the data into XML and then use OPENXML (with all it's memory bloat) to shred the data into a table with a single insert statement and it performs better than the multiple calls from the middle tier or client.

The assumption is correct : row by row management is much slower than an enssemblist aproach . That's exactly why bcp tool exists: bulk copy data from flat file to database. If you can pass parameter through a sp, i guess you can easily store them on a flat file, load it in database and apply your stored proc on an enssemblist way. I bet you'll come back to what dataserver is best for.

Fred

 

Post #355189
Posted Monday, April 2, 2007 5:19 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 6:52 AM
Points: 13,920, Visits: 28,314
We probably could use BCP and realize some performance improvements, definately. However, we're finding the performance is more than adequate, we've got it in Production as well as having tested it to a fair thee well, and the amount of code on both sides of the equation, the app server & the database, is a lot less than implementing a bcp solution would be. It really is working. Don't get me wrong. I don't see it as a magic bullet. It merely fills our needs well and could fill others needs under similar circumstances. As usual with databases, it depends.

----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of: SQL Server Query Performance Tuning
SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #355306
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse