index

Accessing an array element when returning from a function

Some searching through Google (and my own experience) shows that in PHP you can't grab an array element when it's been returned from a function call on the same line. For example, you can't do: echo getArray()[0]; However, I've come across a neat little trick: echo ${!${false}=getArray()}[0]; It actually works. Problem is, I do...

MySQL Analyze and Optimize - Are they required if only inserts - and the table has no joins?

Hi, I have a MyISAM table in MySQL which consists of two fields (f1 integer unsigned, f2 integer unsigned) and contains 320 million rows. I have an index on f2. Every week I insert about 150,000 rows into this table. I would like to know what is the frequency with which I need to run "analyze" and "optimize" on this table (as it would ...

exist xml database - full text index using Lucene

Hi i using Lucene to create index in my xml eXist database. In this time need to get all index (want create tag). I should use xpath query? or need write something in java? ...

Disable autocommit during hundreds of MySQL UPDATE statements in Django program

In a Django program, how to explicitly disable auto transaction management before hundreds of UPDATEs and enable it after the UPDATEs finish? I looked into http://docs.djangoproject.com/en/dev/topics/db/transactions/ but didn't find any clue. I tried to put the following code at the beginning settings.DISABLE_TRANSACTION_MANAGEMENT = ...

MS Sql 2008 index on two columns for 2D position

Hi, I have table named "Map" with structure "XPos int, YPos int, FieldType int". The "XPos" and "YPos" are primary key. There are several tables depending on this table, referencing "XPos" and "YPos" columns. In "Map" table users can not add or remove rows. Rarely is changed value in "FieldType" column. The most selects looks like: ...

Will inserting half a million entries with the same date value be slowed by a non-unique index on that date column?

I have a cursor that selects all rows in a table, a little over 500,000 rows. Read a row from cursor, INSERT into other table, which has two indexes, neither unique, one numeric, one 'DATE' type. COMMIT. Read next row from Cursor, INSERT...until Cursor is empty. All my DATE column's values are the same, from a timestamp initialized at t...

How can I find the index of the maximum value in a matrix column in MATLAB?

I'm trying to find the maximum value of a certain column in a matrix. I want to find both the maximum value and the index of the row in which it is. How can I do this? ...

Interpreting an execution plan

Hello, I need some help analysing some simple t-sql execution plans. I have a table [User] with the following 3 columns: Id(Primary Key), Username(nvarchar(50)), FirstName(nvarchar(50)) I have Created an Unique NonClustered Index for the Username column The execution plan for a query filtering by FirstName: select * from [User] where...

How do you use a string as an Index?

Morning. Issue:I have a class called Reports. Two constructors. One allows no parameters, the other a string array. The string array is supposed to be the reports they'd like to display. What I'd like to do is the following: string strSQL = this.Queries[strReportName]; I have a feeling it's possible because in the dataGridView I'...

Is it better to create an index before filling a table with data, or after the data is in place?

I have a table of about 100M rows that I am going to copy to alter, adding an index. I'm not so concerned with the time it takes to create the new table, but will the created index be more efficient if I alter the table before inserting any data or insert the data first and then add the index? ...

jQuery getting value of array by index

Hello, using jQuery, I'm trying to get values of fileTypes by using an index. I'm not sure how to do go about doing this but so far I've tried settings.fileTypes[0] which does not work. Any help is appreciated, thanks! var defaults = { fileTypes : { windows: 'Setup_File.exe', mac: 'Setup_File.dmg', ...

SQL Query Slow? Should it be?

Using SQLite, Got a table with ~10 columns. Theres ~25million rows. That table has an INDEX on 'sid, uid, area, type'. I run a select like so: SELECT sid from actions where uid=1234 and area=1 and type=2 That returns me 1571 results, and takes 4 minutes to complete. Is that sane? I'm far from an SQL expert, so hopefully someone ca...

PHP $_Post variables print but still give index errors?

Hey, I've got what has become an extremely frustrating problem with $_Post variables. I'll give examples of code rather than the actual segments to save time and confusion. On one page I'm doing this: <? echo "<form name='form' action='page.php' method='post'> <input type='hidden' name='slot' value=".$i."> </form>"; ...

Git: how to reset a working file to its index version?

The problem is the following: how to fetch a few files from a previous commit in git? I could get the files one by one and replace them by their old version: git show <commit>:<path> >! path However, I would like to know whether there is a different way of performing the same thing, possibly with git reset. In fact, I gather that ...

How multiple column b-tree index is organized

I want to understand better index organization. Imagine we have a table with 2 columns: CREATE TABLE user( name varchar(100) ,age int) We would like to create an index: CREATE INDEX IDX_MultiColIdx on user(name,age) How would B-Tree index organization look like? In case of one column, say, age, the organization is clear: eve...

What's the best field type and data usage to accelerate searches?

I have a question about equivalent search result, that can occur on different fields. Let's say I record the logical deletion state of records with 3 fields like : Boolean Deleted Date DeleteDate String DeleteUserName The goal of the query is to avoid having deleted records into my selection. So I can search the first field with on...

hardware specialized for bitmap indexes?

This is just an out of curiosity question. Let's say you have a database table with 1m rows in it, and you want to often do queries like looking for either male or female, US or non-US, voter or non-voter etc, it's clearly very efficient to define a bitmap index for the table in which each bit represents one either-or condition. However...

How to create indexes on multiple columns

We have the following entity relationships where a User belongs to a particular Organization. My queries either look like "select * from User where org=:org" or "select * from User where org=:org and type=:type" I have separate indexes on the User class. The first query will be fine, because of the Index on the foreign key element. Does...

Javascript: Sort array and return an array of indicies that indicates the position of the sorted elements with respect to the original elements.

Suppose I have a Javascript array, like so: var test = ['b', 'c', 'd', 'a']; I want to sort the array. Obviously, I can just do this to sort the array: test.sort(); //Now test is ['a', 'b', 'c', 'd'] But what I really want is an array of indices that indicates the position of the sorted elements with respect to the original elemen...

MongoDB: What’s the most efficient way to store a chromosome/position

I want to store some genomic positions (chromosome,position) using MongoDB. something like: { chrom:"chr2", position:100, name:"rs25" } I want to be able to quickly find all the records in a given segment (chrom , [posStart - posEnd]). What would be the best key/_id to be used ? a chrom , position object ? db.snps.save({_id:{chrom...