indexing

How to get the array index or iteration number with an each iterator?

I'm iterating through an array in ruby with each. Is there an easy way to get the iteration number or array index without going back to a for loop? ...

Indexing in Sql Server

What is Clustured and non clustured indexing? How to index a table using sql server 2000 Enterprise manager? thanks in advance for your kind reply.. ...

database for analytics

I'm setting up a large database that will generate statistical reports from incoming data. The system will for the most part operate as follows: Approximately 400k-500k rows - about 30 columns, mostly varchar(5-30) and datetime - will be uploaded each morning. Its approximately 60MB while in flat file form, but grows steeply in the ...

DynamicFields in Solr

In my current project i need to index all e-mails and their attachments from multiple mailbox. I will use Solr and I don't know what is the best approach to build my index's structure. My first approach was: <fields> <field name="id" require="true"/> <field name="uid" require="true"/> //A lot of other fields <dynamicField name="attachm...

Using both a GUID and an auto-incrementing integer

I've been investigating the use of GUIDs as primary keys in databases. So far, the pros seem to outweigh the cons. However, I see one point where GUIDs may not be what I want. In my application, users should be able to identify objects based on a user-friendly ID. So, for example, if they want to get a specific product without typing in...

C# DataSet Index

Hello, I need to find records in a dataset that have certain values from more than 1 column. I cannot use the Find or Contains method since they require a primary key and my search values can be non-unique. Do DataSets have indexes (Much like a SQL table) that I can use to speed up my search? Right now I'm looping through the dataSet do...

How can I determine if my ActiveRecord object violates a unique database key/index?

ActiveRecord's validates_uniqueness_of is vulnerable to race conditions. To really ensure uniqueness requires additional safeguards. One suggestion from the ActiveRecord RDocs is to create a unique index on the database, for example by including in your migrations: add_index :recipes, :name, :unique => true This will ensure at the d...

Best algorithm to index sentences.

Hello there, Imagine I have a situation where I need to index sentences. Let me explain it a little bit deeper. For example I have these sententes: The beautiful sky. Beautiful sky dream. Beautiful dream. As far as I can imagine the index should look something like this: But also I would like to do search by any of these words...

Index on images to access data in a database

Hi We have the Trie structure to efficiently access data when the key to that data set is a string. What would be the best possible index if key to a data set is an image? By key, I mean some thing which uniquely distinguishes data. Is this a less frequently used scenario i.e. accessing data by an image? I do feel there are application...

SQL Server Indexes

What's the Need for going for Non-clustered index even though table has clustered index? ...

SQL Server indexes - ascending or descending, what difference does it make?

When you create an index on a column or number of columns in MS SQL Server (I'm using version 2005), you can specify that the index on each column be either ascending or descending. I'm having a hard time understanding why this choice is even here. Using binary sort techniques, wouldn't a lookup be just as fast either way? What differenc...

Slow bulk insert for table with many indexes

I try to insert millions of records into a table that has more than 20 indexes. In the last run it took more than 4 hours per 100.000 rows, and the query was cancelled after 3½ days... Do you have any suggestions about how to speed this up. (I suspect the many indexes to be the cause. If you also think so, how can I automatically drop...

Database Indexes

How would you explain to some one how indexes improve the performance of the database when used judiciously ? I am looking for a good, clear explanation since it's too complex out there in the books. ...

Declaring an Index as unique in SQL Server

If I know an index will have unique values, how will it affect performance on inserts or selects if I declare it as such. If the optimiser knows the index is unique how will that affect the query plan? I understand that specifying uniquenes can serve to preserve integrity, but leaving that discussion aside for the moment, what are the...

Why does the cardinality of an index in MySQL remain unchanged when I add a new index?

I have added a FULLTEXT index to one of my MySQL database tables as follows: ALTER TABLE members ADD FULLTEXT(about,fname,lname,job_title); The problem is that using phpmyadmin I can see the cardinality of my new index is only 1. Does this mean the index will never be used? I have run a analyze table command but it didn't seem to do ...

Adding a column efficently in SQL Server

I want to add an integer column to a table with a large number of rows and many indexes (Its a data warehouse Fact Table). To keep the row width as narrow as possible all the columns in this table are defined as not null. So I want the new column to be not null with a default of zero. From experience adding this column will take some t...

What are the disadvantages of having many indices?

I recently sped up a complicated query by an order of magnitude by giving SQLite a good index to work with. Results like this make me wonder if I should index a lot of other fields that are commonly used for JOINs or ORDER BY clauses. But I don't want to get overzealous and have it backfire on me: I assume there must be some reasons not ...

List of all index & index columns in SQL Server DB

How do I get a list of all index & index columns in SQL Server 2005+? The closest I could get is: select s.name, t.name, i.name, c.name from sys.tables t inner join sys.schemas s on t.schema_id = s.schema_id inner join sys.indexes i on i.object_id = t.object_id inner join sys.index_columns ic on ic.object_id = t.object_id inner join s...

What's the difference between B-Tree and GiST index methods (in PostgreSQL)?

I have been working on optimizing my Postgres databases recently, and traditionally, I've only ever use B-Tree indexes. However, I saw that GiST indexes suport non-unique, multicolumn indexes, in the Postgres 8.3 documentation. I couldn't, however, see what the actual difference between them is. I was hoping that my fellow coders migh...

Shared values in column between datatables in ado.net

I'm using c# and i have three datatables, all three have an int column named idnum, what i need is to keep all numbers in the column idnum unique in the three tables and the next number will always be the small available. For example: table a idnum=1 idnum=3 idnum=4 table b idnum=2 idnum=7 table c idnum=8 in this case the n...