Search Results

Search found 1650 results on 66 pages for 'indexes'.

Page 4/66 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • SQL SERVER – Understanding ALTER INDEX ALL REBUILD with Disabled Clustered Index

    - by pinaldave
    This blog is in response to the ongoing communication with the reader who had earlier asked the question of SQL SERVER – Disable Clustered Index and Data Insert. The same reader has asked me the difference between ALTER INDEX ALL REBUILD and ALTER INDEX REBUILD along with disabled clustered index. Instead of writing a big theory, we will go over the demo right away. Here are the steps that we intend to follow. 1) Create Clustered and Nonclustered Index 2) Disable Clustered and Nonclustered Index 3) Enable – a) All Indexes, b) Clustered Index USE tempdb GO -- Drop Table if Exists IF EXISTS (SELECT * FROM sys.objects WHERE OBJECT_ID = OBJECT_ID(N'[dbo].[TableName]') AND type IN (N'U')) DROP TABLE [dbo].[TableName] GO -- Create Table CREATE TABLE [dbo].[TableName]( [ID] [int] NOT NULL, [FirstCol] [varchar](50) NULL ) GO -- Create Clustered Index ALTER TABLE [TableName] ADD CONSTRAINT [PK_TableName] PRIMARY KEY CLUSTERED ([ID] ASC) GO -- Create Nonclustered Index CREATE UNIQUE NONCLUSTERED INDEX [IX_NonClustered_TableName] ON [dbo].[TableName] ([FirstCol] ASC) GO -- Check that all the indexes are enabled SELECT OBJECT_NAME(OBJECT_ID), Name, type_desc, is_disabled FROM sys.indexes WHERE OBJECT_NAME(OBJECT_ID) = 'TableName' GO Now let us disable both the indexes. -- Disable Indexes -- Disable Nonclustered Index ALTER INDEX [IX_NonClustered_TableName] ON [dbo].[TableName] DISABLE GO -- Disable Clustered Index ALTER INDEX [PK_TableName] ON [dbo].[TableName] DISABLE GO -- Check that all the indexes are disabled SELECT OBJECT_NAME(OBJECT_ID), Name, type_desc, is_disabled FROM sys.indexes WHERE OBJECT_NAME(OBJECT_ID) = 'TableName' GO Next, let us rebuild all the indexes and see the output. -- Test 1: ALTER INDEX ALL REBUILD -- Rebuliding should work fine ALTER INDEX ALL ON [dbo].[TableName] REBUILD GO -- Check that all the indexes are enabled SELECT OBJECT_NAME(OBJECT_ID), Name, type_desc, is_disabled FROM sys.indexes WHERE OBJECT_NAME(OBJECT_ID) = 'TableName' GO Now, once again disable indexes for the second test. -- Disable Indexes -- Disable Nonclustered Index ALTER INDEX [IX_NonClustered_TableName] ON [dbo].[TableName] DISABLE GO -- Disable Clustered Index ALTER INDEX [PK_TableName] ON [dbo].[TableName] DISABLE GO -- Check that all the indexes are disabled SELECT OBJECT_NAME(OBJECT_ID), Name, type_desc, is_disabled FROM sys.indexes WHERE OBJECT_NAME(OBJECT_ID) = 'TableName' GO Next, let us build only the clustered index and see the output of all the indexes. -- Test 2: ALTER INDEX REBUILD -- Rebuliding should work fine ALTER INDEX [PK_TableName] ON [dbo].[TableName] REBUILD GO -- Check that only clustered index is enabled SELECT OBJECT_NAME(OBJECT_ID), Name, type_desc, is_disabled FROM sys.indexes WHERE OBJECT_NAME(OBJECT_ID) = 'TableName' GO Let us do final clean up. -- Clean up DROP TABLE [TableName] GO From the example, it is very clear that if you have built only clustered index when the nonclustered index is disabled, it still remains disabled. Do let me know if the idea is clear. Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: Pinal Dave, SQL, SQL Authority, SQL Index, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • Compacting solr indexes

    - by womble
    I've got a sizeable Solr server which is chewing a pile of disk. Whilst it is indexing a large amount of data, I'm wondering if there's any operation that will reduce the size of the index, by say dropping deleted-but-still-allocated data in a similar manner to a VACUUM FULL in PostgreSQL, or are the solr indexes kept fairly tidy, and my only option is to just allocate a pile more diskspace?

    Read the article

  • Syntax for DBCC CHECKTABLE on all indexes?

    - by GuinnessFan
    Just want to check the syntax to make sure this is for one table and all indexes (default?). --must be single user ALTER DATABASE database_name SET SINGLE_USER; DBCC CHECKTABLE ( "table_name" , REPAIR_ALLOW_DATA_LOSS ) WITH ALL_ERRORMSGS; -- TURN BACK MULTI USER ALTER DATABASE database_name SET MULTI_USER; Also, should I be in the database containing the table to repair or should I be in master?

    Read the article

  • mod_rewrite in conjunction with "options indexes"

    - by Travis
    I have a directory ("files") where sub-directories and files are going to be created and stored over time. The directories also need to deliver a directory listing, using "options indexes", but only if a user is authenticated, and authorized. I have that part built, and working, by doing the following: <Directory /var/www/html/files> Options Indexes IndexOptions FancyIndexing SuppressHTMLPreamble HeaderName /includes/autoindex/auth.php </Directory> Now I need to take care of file delivery. To force authentication for files, I have built the following: RewriteCond %{REQUEST_URI} -f RewriteRule /files/(.*) /auth.php I also tried: RewriteCond %{REQUEST_URI} !-d RewriteRule /files/(.*) /auth.php Both directives are redirecting to auth.php when I request: foo.com/files/bar/ foo.com/files/bar/baz I am outputting the SERVER global on auth.php during testing and it is showing the requests as I made them (I thought Apache may have been doing something behind the scenes by adding something like "index.html" to the end with "Options Indexes" being on). Ideas?

    Read the article

  • Using indexes on/through a MySQL view

    - by Peeja
    We've got a MySQL table in which rows are never updated, but instead new rows are added and the old ones marked obsolete. Think Rails' acts_as_paranoid, but for every update. To make working with Rails sane, we've got a view which selects only the rows which are "current". That makes a much better "table" for our ActiveRecord model. The snag: our indexes aren't being used anymore. Queries on the view don't use the underlying tables' indexes. You can't add an index to a view. Without indexes, the app is unbearably slow. The only solution we've come up with is to build a materialized view, but that's a pain in MySQL because they're not natively supported. Is there a better way to do this?

    Read the article

  • Putting curly braces in a sentences for specific words according to their start and end indexes

    - by Suneeta Singh
    I need to put curly braces in a sentence according to the indexes. Suppose my input sentence is: "I am a girl and I live in Nepal." and I need to put curly braces according to [12, 15], [2, 4], [23, 25] These indexes are corresponding to the words "am", "and" and "in" respectively. The required output should be: "I {am} a girl {and} I live {in} Nepal." I have tried using substring but after it replaces first word, it then shifts the characters by two indexes and that is the problem I am having. Can anyone provide me solution to get the required output?

    Read the article

  • Mongoose Not Creating Indexes

    - by wintzer
    I have been trying all afternoon to get my node.js application to create MongoDB indexes properly. I am using the Mongoose ODM and in my schema definition below I have the username field set to a unique index. The collection and document all get created properly, it's just the indexes that aren't working. All the documentation says that the ensureIndex command should be run at startup to create any indexes, but none are being made. I'm using MongoLab for hosting if that matters. I have also repeatedly dropped the collection. Please tell me what I'm doing wrong. var schemaUser = new mongoose.Schema({ username: {type: String, index: { unique: true }, required: true}, hash: String, created: {type: Date, default: Date.now} }, { collection:'Users' }); var User = mongoose.model('Users', schemaUser); var newUser = new Users({username:'wintzer'}) newUser.save(function(err) { if (err) console.log(err); });

    Read the article

  • MySQL regexp on Indexes

    - by Vivek
    HI, I have query having multiple regexp in where clause. The coloumns contained in the where clause have already been indexed. But the query is not using the indexes. Does MySql regexp cause use of indexes ? If not, what could be the workaround for this ?

    Read the article

  • Google App Engine - Error vacuuming indexes

    - by Spines
    I had an index that had status error, so following the docs I tried to vacuum my indexes to remove it. When running appcfg.py to vacuum it I got this error message: Error 400: --- begin server output --- Deleting a composite index failed: ApplicationError: 1 --- end server output --- Now all of my indexes are in error state. How can I fix this?

    Read the article

  • Generate T-SQL for Existing Indexes

    - by Chris S
    How do you programmatically generate T-SQL CREATE statements for existing indexes in a database? SQL Studio provides a "Script Index as-Create to" command that generates code in the form: IF NOT EXISTS(SELECT * FROM sys.indexes WHERE name = N'IX_myindex') CREATE NONCLUSTERED INDEX [IX_myindex] ON [dbo].[mytable] ( [my_id] ASC )WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] GO How would you do this programmatically (ideally through Python)?

    Read the article

  • mysql index optimization for a table with multiple indexes that index some of the same columns

    - by Sean
    I have a table that stores some basic data about visitor sessions on third party web sites. This is its structure: id, site_id, unixtime, unixtime_last, ip_address, uid There are four indexes: id, site_id/unixtime, site_id/ip_address, and site_id/uid There are many different types of ways that we query this table, and all of them are specific to the site_id. The index with unixtime is used to display the list of visitors for a given date or time range. The other two are used to find all visits from an IP address or a "uid" (a unique cookie value created for each visitor), as well as determining if this is a new visitor or a returning visitor. Obviously storing site_id inside 3 indexes is inefficient for both write speed and storage, but I see no way around it, since I need to be able to quickly query this data for a given specific site_id. Any ideas on making this more efficient? I don't really understand B-trees besides some very basic stuff, but it's more efficient to have the left-most column of an index be the one with the least variance - correct? Because I considered having the site_id being the second column of the index for both ip_address and uid but I think that would make the index less efficient since the IP and UID are going to vary more than the site ID will, because we only have about 8000 unique sites per database server, but millions of unique visitors across all ~8000 sites on a daily basis. I've also considered removing site_id from the IP and UID indexes completely, since the chances of the same visitor going to multiple sites that share the same database server are quite small, but in cases where this does happen, I fear it could be quite slow to determine if this is a new visitor to this site_id or not. The query would be something like: select id from sessions where uid = 'value' and site_id = 123 limit 1 ... so if this visitor had visited this site before, it would only need to find one row with this site_id before it stopped. This wouldn't be super fast necessarily, but acceptably fast. But say we have a site that gets 500,000 visitors a day, and a particular visitor loves this site and goes there 10 times a day. Now they happen to hit another site on the same database server for the first time. The above query could take quite a long time to search through all of the potentially thousands of rows for this UID, scattered all over the disk, since it wouldn't be finding one for this site ID. Any insight on making this as efficient as possible would be appreciated :) Update - this is a MyISAM table with MySQL 5.0. My concerns are both with performance as well as storage space. This table is both read and write heavy. If I had to choose between performance and storage, my biggest concern is performance - but both are important. We use memcached heavily in all areas of our service, but that's not an excuse to not care about the database design. I want the database to be as efficient as possible.

    Read the article

  • SQL Overlapping and Multi-Column Indexes

    - by durilai
    I am attempting to tune some stored procedures and have a question on indexes. I have used the tuning advisor and they recommended two indexes, both for the same table. The issue is one index is for one column and the other is for multiple columns, of which it includes the same column from the first. My question is why and what is the difference? CREATE NONCLUSTERED INDEX [_dta_index_Table1_5_2079723603__K23_K17_K13_K12_K2_K10_K22_K14_K19_K20_K9_K11_5_6_7_15_18] ON [dbo].[Table1] ( [EfctvEndDate] ASC, [StuLangCodeKey] ASC, [StuBirCntryCodeKey] ASC, [StuBirStOrProvncCodeKey] ASC, [StuKey] ASC, [GndrCodeKey] ASC, [EfctvStartDate] ASC, [StuHspncEnctyIndctr] ASC, [StuEnctyMsngIndctr] ASC, [StuRaceMsngIndctr] ASC, [StuBirDate] ASC, [StuBirCityName] ASC ) INCLUDE ( [StuFstNameLgl], [StuLastOrSrnmLgl], [StuMdlNameLgl], [StuIneligSnorImgrntIndctr], [StuExpctdGrdtngClYear] ) WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY] go CREATE NONCLUSTERED INDEX [_dta_index_Table1_5_2079723603__K23] ON [dbo].[Table1] ( [EfctvEndDate] ASC )WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY]

    Read the article

  • Indexes and multi column primary keys

    - by David Jenings
    Went searching and didn't find the answer to this specific noob question. My apologies if I missed it. In a MySQL database I have a table with the following primary key PRIMARY KEY id (invoice, item) In my application I will also frequently be selecting on "item" by itself and less frequently on only "invoice". I'm assuming I would benefit from indexes on these columns. MySQL does not complain when I define the following: INDEX (invoice), INDEX (item), PRIMARY KEY id (invoice, item) But I don't see any evidence (using DESCRIBE -- the only way I know how to look) that separate indexes have been established for these two columns. So the question is, are the columns that make up a primary key automatically indexed individually? Also, is there a better way than DESCRIBE to explore the structure of my table?

    Read the article

  • Database indexes - what should they be

    - by WebweaverD
    Most of my database tables have a clear unique index through which lookups are done 90% of the time but I am a bit unsure on this one - I have a table which keeps track of user rating totals for items in my database, I now want to add another table, to track individual ratings with an ip address column to make sure no one can rate something twice. Since I can see this becoming a big, high use table it is important to optimize it correctly. (MYSQL table) This table will have the following fields: rating_id(always - unique), item_id (always - not unique), user_id (optional - not unique), ip_address (always - not unique), rating_value(always - not unique), has_review(bool) Now I envisions 90% the queries going something like this: When a user rates something - select where item_id = x and ip_address = y, (if rows = 0) insert rating When in user account pages - select where ip_address = x or username = y Now none of the fields searched on are unique, can I still use them as indexes (for example item _id and ip_address), can I have two indexes and will this still improve performance over a non indexed table?

    Read the article

  • MySQL indexes - what are the best practises?

    - by Haroldo
    I've been using indexes on my mysql databases for a while now but never properly learnt about them. Generally I put an index on any fields that i will be searching or selecting using a WHERE clause but sometimes it doesn't seem so black and white. What are the best practises for mysql indexes? example situations/dilemas: If a table has six columns and all of them are searchable, should i index all of them or none of them? . What are the negetive performance impacts of indexing? . If i have a VARCHAR 2500 column which is searchable from parts of my site, should i index it?

    Read the article

  • Add Scheduled Task to reset search indexes for Exchange 2007

    - by Samosa
    I simply want to run a ResetSearchIndex -force on a schedule. What is the correct usage for the command in the Scheduled Task properties? It seems I would first need to start Powershell, then load the console file or snap-in for Exchange, which one of these is the closest: C:\WINDOWS\system32\WINDOW~2\v1.0\POWERS~1.EXE -"D:\Program Files\Microsoft\Exchange Server\Scripts" ResetSearchIndex.ps1 -force dbname or C:\WINDOWS\system32\WINDOW~2\v1.0\POWERS~1.EXE -PSConsoleFile "D:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -noexit -command ".'D:\Program Files\Microsoft\Exchange Server\Scripts' ResetSearchIndex.ps1 -force dbname or C:\WINDOWS\system32\WINDOW~2\v1.0\POWERS~1.EXE -PSConsoleFile "D:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -noexit -command ".'D:\Program Files\Microsoft\Exchange Server\Scripts\ResetSearchIndex.ps1' -force dbname

    Read the article

  • Good strategy for copying a "sliding window" of data from a table?

    - by chiborg
    I have a MySQL table from a third-party application that has millions of rows and only one index - the timestamp of each entry. Now I want to do some heavy self-joins and queries on the data using fields other than the timestamp. Doing the query on the original table would bring the database to a crawl, adding indexes to the table is not an option. Additionally, I only need entries that are newer than one week. My current strategy for doing the queries efficiently is to use a separate table (aux_table) that has the necessary indexes. My questions are: Is there another way to do the queries? and if not, How do I update the data in the indexed table efficiently? So far I have found two approaches for updating aux_table: Truncate aux_table and insert the desired data from the original table. Not very efficient because all the indexes must be re-crated. Check for the biggest timestamp in aux_table and insert all entries with a greater or equal timestamp from the original table. Occasionally drop older entries. Only copying entries with greater timestamp leads to dropped entries (because of entries with same timestamp that were inserted into the original table after the last update).

    Read the article

  • Ordering z-indexes in an array

    - by Tom Gullen
    I have an array which looks something along the lines of resourceData[0][0] = "pic1.jpg"; resourceData[0][1] = 5; resourceData[1][0] = "pic2.jpg"; resourceData[1][1] = 2; resourceData[2][0] = "pic3.jpg"; resourceData[2][1] = 900; resourceData[3][0] = "pic4.jpg"; resourceData[3][1] = 1; The numeric represents the z-index of the image. Minimum z-index value is 1. Maximum (not really important) is 2000. I have all the rendering and setting z-indexes done fine. My question is, I want to have four functions: // Brings image to z front function bringToFront(resourceIndex) { // Set z-index to max + 1 resourceData[resourceIndex][1] = getBiggestZindex() + 1; // Change CSS property of image to bring to front $('#imgD' + resourceIndex).css("z-index", resourceData[resourceIndex][1]); } function bringUpOne(resourceIndex) { } function bringDownOne(resourceIndex) { } // Send to back z function sendToBack(resourceIndex) { } So given then index [3] (900 z): If we send it to the back, it will take the value 1, and [3] will have to go to 2, but that conflicts with [1] who has a 2 z-index so they need to go to three etc. Is there an easy programatical way of doing this because as soon as I start doing this it's going to get messy. It's important that the indexes of the array don't change. We can't sort the array unfortunately due to design. Update Thanks for answers, I'll post the functions here once they are written incase anyone comes across this in the future (note this code has zindex listed in [6]) // Send to back z function sendToBack(resourceIndex) { resourceData[resourceIndex][6] = 1; $('#imgD' + resourceIndex).css("z-index", 1); for (i = 0; i < resourceData.length; i++) { if (i != resourceIndex) { resourceData[i][6]++; $('#imgD' + i).css("z-index", resourceData[i][6]); } } }

    Read the article

  • C++ Recursive function that reverses the order of an array's indexes between two bounds

    - by CPT Kirk
    I am trying to write a recursive function that has three arguments; an array and two array indexes. The function should reverse the order of the values between the two indexes. I would like to understand what is happening instead of just being told an answer. Here is my code so far: #include <iostream> using namespace std; char switchAroo(char a[], int b1, int b2); int main() { char a[6] {'A', 'B', 'C', 'D', 'E', '\0'}; cout << a; switchAroo(a, 2, 5); return 0; } char switchAroo(char a [], int b1, int b2) { char temp; if (b1 == b2) cout << "The array after switchAroo is " << a << endl; else { temp = a[b1]; a[b1] = a[b2]; a[b2] = temp; b1++; b2--; return switchAroo(a, b1, b2); } } I am getting the following warning code: warning C4715: 'switchAroo' : not all control paths return a value Any help would be greatly appreciated.

    Read the article

  • Lucene multiple indexes : Normalize document scores??

    - by Roey
    Hi All. Suppose I've got multiple lucene indexes (not replicas) on several PC's. I query each index and then merge the results. Is there any way to normalize the document scores so that I could sort by score (relevance)? I mean, the scores for document A from index A would not be comparable with document B from index B, unless I do some sort of normalization.... not so? Thanks Roey

    Read the article

  • Tokyo Tyrant indexes

    - by viraptor
    I was wondering about size requirements for Tokyo Tyrant indexes. If I have an index on field x and insert a record with fields y and z only, does the x index grow? Also: does the insert time grow in that case?

    Read the article

  • Firefox add-on for examining z-indexes

    - by hekevintran
    I'm working on a fairly large site and am having trouble managing z-indexes. Is there a Firefox add-on that will look at a page and give me an ordered list of every element with a z-index declared? That would save a ton of times for the cases where a z-index was wrong or hard to find.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >