Jump to content

Recommended Posts

Posted

That's extremely useful information Phil!

 

I'd always assumed that on the backend of the reporting engine, SQL was generated; you'd expect SQL server to optimise for this kind of thing automatically. Maybe there's actually some kind of intermediate step, where temporary tables are built and then filtered (either by deleting records, or by copying into a new temp table?)

 

As far as indexing goes, if you pull out a dump of the SQL database you can see what those are (or just look at the database itself).

 

 

Indexing dates can be a bit nasty in SQL server unless you're canny about it, so I can see that the date field might not be indexed. On the other hand, it might just be that the filter on achievement type cut out more records earlier on. Weirdly, I've found on some reports that adding a filter can slow things down! Some "flat" tables are actually views pulling multiple tables together (e.g. student <-> student/achievement relation <-> achievements <-> achievement types ), so being able to miss out certain columns can help with speed too.

Posted
That's extremely useful information Phil!

 

I'd always assumed that on the backend of the reporting engine, SQL was generated; you'd expect SQL server to optimise for this kind of thing automatically. Maybe there's actually some kind of intermediate step, where temporary tables are built and then filtered (either by deleting records, or by copying into a new temp table?)

 

As far as indexing goes, if you pull out a dump of the SQL database you can see what those are (or just look at the database itself).

 

 

Indexing dates can be a bit nasty in SQL server unless you're canny about it, so I can see that the date field might not be indexed. On the other hand, it might just be that the filter on achievement type cut out more records earlier on. Weirdly, I've found on some reports that adding a filter can slow things down! Some "flat" tables are actually views pulling multiple tables together (e.g. student <-> student/achievement relation <-> achievements <-> achievement types ), so being able to miss out certain columns can help with speed too.

 

Matt thanks for the reply, I don't have access to the DBMS as our servers are managed by Capita and locked down ! I would love a peek inside the database though :)

Posted
I'd always assumed that on the backend of the reporting engine, SQL was generated; you'd expect SQL server to optimise for this kind of thing automatically. Maybe there's actually some kind of intermediate step, where temporary tables are built and then filtered (either by deleting records, or by copying into a new temp table?)

I'd put money on that the intermediate step involves an Excel file or a CSV :p

 

This is useful to look at indexes - there are a number of variants, but this gives a decent list. If you remove the last where condition there are some 1600.

I wouldn't want to publish as it's giving away a lot of info on the tables / names etc. Not really for public or competitors to see ;)

 

SELECT      TableName = t.name,
    IndexName = ind.name,
    IndexId = ind.index_id,
    ColumnId = ic.index_column_id,
    ColumnName = col.name
FROM 
    sys.indexes ind 
INNER JOIN 
    sys.index_columns ic ON  ind.object_id = ic.object_id and ind.index_id = ic.index_id 
INNER JOIN 
    sys.columns col ON ic.object_id = col.object_id and ic.column_id = col.column_id 
INNER JOIN 
    sys.tables t ON ind.object_id = t.object_id 
WHERE 
    ind.is_primary_key = 0 
    --AND ind.is_unique = 0 
    --AND ind.is_unique_constraint = 0 
    AND t.is_ms_shipped = 0 
    AND t.name like '%achieve%'
ORDER BY 
    t.name, ind.name, ind.index_id, ic.index_column_id

Posted
I'd put money on that the intermediate step involves an Excel file or a CSV :p

 

This is useful to look at indexes - there are a number of variants, but this gives a decent list. If you remove the last where condition there are some 1600.

I wouldn't want to publish as it's giving away a lot of info on the tables / names etc. Not really for public or competitors to see ;)

 

SELECT      TableName = t.name,
    IndexName = ind.name,
    IndexId = ind.index_id,
    ColumnId = ic.index_column_id,
    ColumnName = col.name
FROM 
    sys.indexes ind 
INNER JOIN 
    sys.index_columns ic ON  ind.object_id = ic.object_id and ind.index_id = ic.index_id 
INNER JOIN 
    sys.columns col ON ic.object_id = col.object_id and ic.column_id = col.column_id 
INNER JOIN 
    sys.tables t ON ind.object_id = t.object_id 
WHERE 
    ind.is_primary_key = 0 
    --AND ind.is_unique = 0 
    --AND ind.is_unique_constraint = 0 
    AND t.is_ms_shipped = 0 
    AND t.name like '%achieve%'
ORDER BY 
    t.name, ind.name, ind.index_id, ic.index_column_id

 

Vikpa, is there any chance of you sending me the output of the SQL .

 

Our DBMS severs are locked down and I have no access.

 

I will treat the data with respect d with confidentiality.

 

I understand if you are unwilling to do so.

 

Many Thanks

 

Phil

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...