indexing

MySQL Indexes: Having multiple indexes vs. having one multi-field key?

When I manually create tables in MySQL, I add indexes one at a time for each field that I think I will use for queries. When I use phpMyAdmin to create tables for me, and I select my indexes in the create-table form, I see that phpMyAdmin combines my indexes into 1 (plus my primary). What's the difference? Is one better than the other?...

Sphinx Delta Indexing issue

I have created delta indexes. and merging them using following commands sudo /usr/local/sphinx/bin/indexer --merge messagecenter_quotations_reply messagecenter_quotations_reply_delta --rotate But It only merges if I restart sphinx. if i run this command with out restarting sphinx I do not get any results . ...

Why index made this query slower?

Table has 1 500 000 records, 1 250 000 of them have field = 'z'. I need select random not 'z' field. $random = mt_rand(1, 250000); $query = "SELECT field FROM table WHERE field != 'z' LIMIT $random, 1"; It is working ok. Then I decided to optimize it and indexed field in table. Result was strange - it was slower ~3 times. I te...

Is an index needed for a primary key in SQLite?

When an integer column is marked as a primary key in an SQLite table, should an index be explicitly created for it as well? SQLite does not appear to automatically create an index for a primary key column, but perhaps it indexes it anyway, given its purpose? (I will be searching on that column all the time). Would the situation be any d...

SQL Server Performance: Non-clustered Index + INCLUDE columns vs. Clustered Index - equivalent?

Hello SQL Server engine experts; please share with us a bit of your insight... As I understand it, INCLUDE columns on a non-clustered index allow additional, non-key data to be stored with the index pages. I am well aware of the performance benefits a clustered index has over a non-clustered index simply due to the 1 fewer step the eng...

Deleting the primary index of a SQLite database

Hi All, I am building an iPhone app which has a quite big SQLite database. In order to make it lighter I thought I could delete the Primary index, and then add it on the first launch. How is would that be possible ? Thank you ...

MySQL Indexes Automatically Disabled - Why?

I noticed some queries were running quite slow all of the sudden. After running EXPLAIN on them I realized they weren't using the indexes that I created. I looked further using SHOW INDEXES and realized that all were disabled except the primary key on the table. I'm certain I didn't disable the indexes manually. I manually enabled th...

Ensuring index is used on Informix DATETIME column

Hi. Say I have a table on an Informix DB: create table password_audit ( username CHAR(20), old_password CHAR(20), new_password CHAR(20), update_date DATETIME YEAR TO FRACTION)); I need the update_date field to be in milliseconds (or seconds maybe - same question applies) because there will be multiple updates of the pa...

How to store ordered items which often change position in DB

I need to be able to store a large list of ordered items in the DB. So far that's straight-forward: ID Position OtherFields 1 45 ... 2 4736 ... 3 514 ... ... In queries, I always need to get just a few items (filtered based on OtherFields) but in the correct order. Easy as well, putting an index on Position...

Are multiple indices needed for multiple where clauses?

Say I have a query like the following: SELECT * FROM users WHERE username = 'test' AND somethingelse = 'test' I'm wondering if it's necessary to index both columns for optimization. Does MySQL first find all username columns with the value 'test', and then search those results for somethingelse columns with 'test'? Or does it happen s...

Retrieving an entity from GAE datastore by key

If I have the google assigned key of an entity in my datastore, say ag1iYXRjaC1nZW5lcmljchcLEgxCYXRjaGVzTW9kZWwiBUpvYiAyDA, is there a way I can easily fetch the entity by this key? I've tried using .get_by_id(), .filter('__key__=', 'ag1iYXRjaC1nZW5lcmljchcLEgxCYXRjaGVzTW9kZWwiBUpvYiAyDA') and can't seem to find anything that works. Any ...

How can I index a 3-D matrix with a 2-D mask in MATLAB?

Suppose I have D, an X-by-Y-by-Z data matrix. I also have M, an X-by-Y "masking" matrix. My goal is to set the elements (Xi,Yi,:) in D to NaN when (Xi,Yi) in M is false. Is there any way to avoid doing this in a loop? I tried using ind2sub, but that fails: M = logical(round(rand(3,3))); % mask D = randn(3,3,2); % data % try getting x,...

Will indexing a SQL table improve the performance of a LINQ statement?

Apologies for what may very well be a stupid question. I'm just intrigued as to (a) will indexing improve performance (b) how will it improve performance and (c) why will it improve performance? Also, if this does improve performance, would this be the case across the board for LINQ to SQL, LINQ to Entities, LINQ to Objects, etc, etc. ...

Disable or speed up DLTK indexing in Eclipse PDT?

I am using Eclipse PDT Helios with Aptana Studio. on Windows XP. Very often, my workflow is interrupted because Eclipse starts a DLTK indexing process that lasts 30 seconds, sometimes up to 2 minutes - which is annoying. I wonder if there is any way to: Either turn that off or Run the DLTK indexing process less frequently. I didn't ...

Questions regarding InvalidJarIndexException?

I went through the JAR specification document and found that an in-memory hashtable is created using INDEX.LST file to speed up the class file look up process. If any one can answer my following questions - When is the hashtable constructed? When the application loads or when the request comes for loading the applet? Since all the cla...

Easiest way to implement a search engine over a set of URLs

I'm trying to implement a simple search engine over a list of HTML documents. I've build a script that generates the needed list of links. There is no need for crawling any other documents. So far I've tried Solr / Nutch (I'm still trying to get them working...), but they feel way overkill for such a simple task. I'm looking for somethi...

Apache Solr - are the documents itself stored internally apart from the index?

Hello, I have been trying to research how solr works when documents like doc or pdf are submitted to it. I want to know if I submit pdfs to solr, does it end up storing the pdf file also along with the index generated after parsing the pdf file? Thanks, -Keshav ...

Can I force Lua's table indexing from zero?

I've read about Lua, it's almost perfect language, but there was critical error. It's one-based indexing. I read also it has a feature to setting value at index 0, but it's not counted table length and string manipulations are still one-based. So the feature is meaningless. I don't want to flame about one-based or zero based. I'm just a...

Search for (Very) Approximate Substrings in a Large Database

I am trying to search for long, approximate substrings in a large database. For example, a query could be a 1000 character substring that could differ from the match by a Levenshtein distance of several hundred edits. I have heard that indexed q-grams could do this, but I don't know the implementation details. I have also heard that L...

Django Haystack substring search

I have recently added search capabilities to my django-powered site to allow employers to search for employees using keywords. When the user initially uploads their resume, I turn it into text, get rid of stop words, and then add the text to a TextField for that user. I used Django-Haystack with the Whoosh search back engine. Three thin...