indexing

Script to add an index on each foreign key?

Seeing as a foreign key does not automatically create an index in SQL Server, I want to create an explicit index on every FK field in my database. And I have over 100 tables in the schema... So, does anyone have a ready packaged script that I could use to detect all FKs and create an index on each? ...

Will a index with 3 fields work for 2 field queries?

Im considering apply an index of 3 fields (type, status, user_id) on a table. The majority of my queries have WHEREs that use all 3. However, I have a couple of heavily used queries which only use 2 fields (type and status). My question, is would creating an index with all 3 fields be used efficiently by queries that only really compar...

How can I stop spotlight indexing slow archive media?

I copied the world onto a 16GB USB stick, and found Spotlight was busy indexing it for an hour or two. I tried naming folders in the privacy tab of Spotlight Preferences, and deleting .Spotlight-V100. This worked, I think, but was not remembered next time I used the stick. ...

What is the algorithm to search an index for multiple values?

This is actually a real problem I'm working on, but for simplicity, let's pretend I'm Google. Say the user searches for "nanoscale tupperware". There aren't very many pages with both words... only about 3k. But there are ~2 million pages with "nanoscale" and ~4 million with "tupperware". Still, Google finds the 3k for me in 0.3 seconds....

mySql performance question about updating indexed field

I have a large table with a multi-part index. I need to run several queries to update a field that is part of the index. Basically every row will be updated. Would it be faster to drop the index, do all the updates and then re-add it? EDIT: Added question, why does it take so freaking long to DROP an index? Am I missing something or ...

background-image in div – Google indexing?

I've a list of empty divs and dynamically inserting a background image – so at first, their background-image: url(); property is completely empty. With some event, it's background-image url loads into the previously empty background-image: url(); tag. The url of the appearing background-image is temporarily stored in the "alt" tag of the...

SQL statistics system table

I have created a statistics in a table using SQL SERVER 2008 . In which system table this information is getting stored (Just like all the table info are stored in in sys.tables)...? ...

Insufficient privilege when creating an index in Oracle 11g

I am trying to create an index in Oracle, my ddl : create index OMD_DOCTEXT2_CTX on table_name(col_name) indextype is ctxsys.context local parameters ('datastore CTXSYS.FILE_DATASTORE filter ctxsys.null_filter lexer E2LEX wordlist E2WORDLIST stoplist E2STOP section group E2GROUP') parallel 4; I am getting error : ORA-29855: error oc...

Fastest way to return a primary key value SQL Server 2005

I have a two column table with a primary key (int) and a unique value (nvarchar(255)) When I insert a value to this table, I can use Scope_identity() to return the primary key for the value I just inserted. However, if the value already exists, I have to perform an additional select to return the primary key for a follow up operation (i...

Windows index server is not indexing shtm files

im using index server for my website search. it indexes all files (asp, pdf, doc) except .shtm files. what should i do to index .shtm files also? -Vivek ...

Search Engines Crawling Question

the main page of my site is /home.php This page has pagination with anchor tags that link to many other queries of the same page, for example /home.php?start=4 /home.php?start=8 and so on... My question is, when i include the home.php page in a sitemap will crawlers crawl what ever page home.php links to(ex. /home.php?star=4)? or d...

In SciPy, using ix_() with sparse matrices doesn't seem to work so what else can I use?

In Numpy, ix_() is used to grab rows and columns of a matrix, but it doesn't seem to work with sparse matrices. For instance, this code works because it uses a dense matrix: >>> import numpy as np >>> x = np.mat([[1,0,3],[0,4,5],[7,8,0]]) >>> print x [[1 0 3] [0 4 5] [7 8 0]] >>> print x[np.ix_([0,2],[0,2])] [[1 3] [7 0]] I used ix...

How to index a MySQL table, where 99% of time I need to query 1% of the data

Hi I have a MySQL table, let's say it is a helpdesk ticketing system. It has a CLOSED column, which I want to index. 99% of time, I will need to only select on OPEN tickets, so something like "SELECT * FROM TICKET_TABLE where CLOSED='N'; " And over time, more and more tickets are CLOSED, while a small constant number of OPEN tickets r...

how to stop using a database index for a particular query?

Is there way to do it? I am currently facing problem as one index is being used unnecessarily in my query (as displayed in the execution plan of the query in sql server 2008) and it is degrading the query performance. This index can not be dropped as it is useful for some other query. ...

How do search engines conduct 'AND' operation?

Consider the following search results: Google for 'David' - 591 millions hits in 0.28 sec Google for 'John' - 785 millions hits in 0.18 sec OK. Pages are indexed, it only needs to look up the count and the first few items in the index table, so speed is understandable. Now consider the following search with AND operation: Goog...

Using find function on columns and rows in matlab

Hi, I am having some problems with the find function in MATLAB. I have a matrix consisting of zeros and ones (representing the geometry of a structural element), where material is present when the matrix element = 1, and where no material is present when the matrix element = 0. The matrix may have the general form shown below (it will ...

SEO: Why "indexed pages" in Webmaster Tools and the command "site:" gives so much difference?

When I go into the Webmasters Tools in Google for my website it gives me "Indexed URLs: 305,509", but when I type in Google "site:" with my url it returns about 19.000 results. How is it possible? ...

How to a remove all database indexes from a SQL server database

I am about to write a script to add new indexes to a database, I wish that script to work regardless of the current indexes the database has. Therefore the first step in the script should be to remove all the current indexes. (I could just as easily run .net code, but I think TSQL will be less painful for this type of thing) (This is ...

How to properly index a table two other tables have a one-to-many relationship to?

Imagine I have three tables, called "customers", "companies" and "phone_numbers". Both customers and companies can have multiple phone numbers. What would be the best way to index phone_numbers? Have both customer_id and company_id and keep one of them null? What if there are more than two tables with a one-to-many relationship with phon...

Striping HTML in SOLR for storage, not indexing

Hey guys, I've managed to strip HTML from content when indexing data in SOLR. But is it possible to strip HTML from data when simply storing data? This is my field: <field name="Content" type="textNoHTML" indexed="true" stored="true"/> And, the field type "textNoHTML" implements the solr.HTMLStripCharFilterFactory: <charFilter clas...