I created a non-clustered index (using the execution plan tools in MSSQLSMS) that greatly speeds up a critical, time-consuming query. My test machine uses SQL Express 2008, but I'm limited to SQL Server 2000 on the production server.
The index includes some non-key columns in an INCLUDE statement:
CREATE NONCLUSTERED INDEX idxTotalFundsUnderManagementQuery_TotalPv
ON PortfolioMovements (PortfolioMovementType, AtDate)
INCLUDE (PortfolioID, SecurityGuid, Units)
INCLUDE isn't supported on SQL Server 2000. Is there a way to include non-key columns in the index?
No: http://msdn.microsoft.com/en-us/library/aa258260(v=sql.80).aspx
It's a performance feature that was introduced in SS 2005 AFAIK.
Related
I have to migrate SQL Sever 2008 database to the SQL Server 2012. 2008 is the enterprise version and 2012 is standard version. As we know, standard version does not support table partitioning.
The table which is partitioned in the enterprise version has 1 clustered and around 8 non-clustered indexed. I need to drop this partition but do not know how. Can someone please shed little light on how should I go about it?
Thanks.
To unpartition a table, you'll need to recreate all the indexes with a filegroup specification instead of parttion scheme. I suggest you drop all the non-clustered indexes and then rebuild the existing partitioned clustered index using CREATE INDEX...WITH(DROP_EXISTING-ON) with a filegroup specification. Then recreate the non-clustered indexes with a filegroup specfied.
There is an option called "ColumnStore Index" available in SQL Server 2012.
Is it comparable with columnar databases such as Cassandra, HBase?
Few advantages of going with SQL Server 2012 can be:
It is Updateable
It is Relational
What other factors can be considered to choose between SQL Server 2012 and other Columnar databases in case faster query performance is a requirement.
I'm not sure what you mean by "it is updatable", but in SQL Server 2012 tables that have a columnstore index cannot be updated. You must first drop the columnstore index or you must partition around the columnstore index in order to support changes to the underlying data.
Also, columnstore indexes are useful in DW systems where very large amounts of data have to be aggregated and accessed quickly.
In SQL Server 2012 you have the alternative of indexed (materialized) views.
I have a database table in SQL Server 2005 Express that takes in 2367 new rows each day, there is only 3 columns for each row. So in a year this will give around 800k of rows and in 10 years 8 million rows. Since I know that the company where I'm making this installation will not handle any database management/cleanup my question is will a SQL Server 2005 Express be able to handle this many rows in a single table? Are there any limits? I do know that there is something like 4gig of file size limit.
EDIT: Table setup
[RefId] [bigint] NOT NULL,
[PointDate] [datetime] NOT NULL,
[PointValue] [decimal](10, 2) NOT NULL
note: SQL Server 2005 Express doesn't allow you to set up jobs.
The database size limit is 10Gb since SQL Server 2008 R2. No matter what, an Express installation will still require maintenance (specially backups). You better think of something now.
The documentation says limited by available storage. So it's likely you'll hit a bottleneck somewhere else first, like some MBA with Access doing select Count() from Table on with an external link to the live database.
Other maximums you might run into first.
MSDN SQL 2005 Capacity Specicifications
Other versions are available from the page as well, for those who have a need.
Many years ago (almost ten) I thought Index View is more like an enterprise edition (SQL 2000) only feature but I was wrong and Index view were indtroducted in SQL 2000 to satifsy competivive product's support for materialize view.
However, You can still create index view and physically materialize that view in all the edition of SQL 2000/2005 and query will use that index on a view if you specify NOEXPAND query hint (which is not needed in enterprise/developer editon)
Here is the white paper on Index View (that confirm what I said earlier)
http://msdn.microsoft.com/en-us/library/dd171921.aspx
However, it appears to me that starting with SQL 2008/R2 index view indeed is an enterprise edition feature.
I did compare feature by different edition
http://msdn.microsoft.com/en-us/library/cc645993.aspx
so in SQL 2008 R2 Standard edition you are able to create index view but looks like NOEXPAND hint will not work so it is almost useless...
Is it possible to create index view and use that index (instead of index on base table) in SQL Server 2008 R2 (standard or express edition) using noexpand hint?
This other article on SQLServerCentral seems to suggest that yes, NOEXPAND continues to work perfectly on every edition of SQL Server from 2005 to 2012. I'll quote:
"Then NOEXPAND hint still works in non-Enterprise editions of SQL Server. I think there has been some confusion as to what this hint actually does. It forces the query optimizer to rely on the view, rather than the underlying table, for optimization. It does not force the query optimizer to use any given index on a view.
The sites I found online stating that NOEXPAND does not work did not include any testing methodology, so I can't say why it did not work for them.I can say that it can work in situations where the query optimizer decides the index is useful."
I was told that there is new a feature in SQL Server 2005 called index filters.
What I want to do is add an Index to a column and have the index ignore null values.
I can't find good information on this feature (maybe my source is wrong). Can anyone provide additional information on this feature?
CREATE INDEX ix_mytable_mycolumn ON mytable(mycolumn) WHERE mycolumn IS NOT NULL
This will work only in SQL Server 2008, though.
From the docs:
WHERE <filter_predicate>
Creates a filtered index by specifying which rows to include in the index. The filtered index must be a nonclustered index on a table. Creates filtered statistics for the data rows in the filtered index.
I think you are speaking about filtered indexes, which were introduced in SQL Server 2008, not 2005.
For information, have a look at this article: http://www.sql-server-performance.com/articles/dba/Filtered_Indexes_in_SQL_Server_2008_p1.aspx
Or just do a google search for "sql server filtered indexes".