indexes

Simple Select Statement on MySQL Database Hanging

I have a very simple sql select statement on a very large table, that is non-normalized. (Not my design at all, I'm just trying to optimize while simultaneously trying to convince the owners of a redesign) Basically, the statement is like this: SELECT FirstName, LastName, FullName, State FROM Activity WHERE (FirstName=@name OR LastName...

MySQL Slow join - but not always and not on all tables

We're experiencing a performance issue with a MySQL database that's so weird we need another set of eyes to tell us whether we're going crazy or not. We've got 2 MySQL Certified Developers in the team, but all they can say is : "this is impossible". Anyway, here's the situation : we have a query that in theory should be reasonbly fast, ...

Integer comparison in mysql using an index

I need to compare integers in a mysql table. Pretty simple, but this table is fairly large... so queries take a long time. No problem, I can use an index. According to MySQL documentation, I should be able to use an index for comparison operators: "A B-tree index can be used for column comparisons in expressions that use the =, >, >=,...

Mysql - sequence of multiple column indexes

Say if I have a query that look like this: SELECT * FROM table WHERE category='5' and status='1' LIMIT 5 The table has 1 million rows. To speed things up, I create index (status, category), i.e. multiple column index. There are 600 categories but only 2 status (1 or 0). I'm wondering if there is any difference in performance if I c...

MySql using primary index instead of multiple column one!

Ok so I've a SQL query here: SELECT a.id,... FROM article AS a WHERE a.type=1 AND a.id=3765 ORDER BY a.datetime DESC LIMIT 1 I wanted to get exact article by country and id and created for that index with two columns type and id. Id is also primary key. I used the EXPLAIN keyword to see which index is used and instead of the multiple...

MYSQL moving the position of an index.

So a search on google didn't turn up anything and neither did StackOverflow so far. Essentially my problem is this: I have a merge table and another normal table I wish to merge into it. Unfortunately one index in this new table is out of position so the merge doesn't work. Existing merge table indexes: KEY `Row ID` (`Row ID`), KEY `C...

Query cost relative to batch is 100%

I'm not sure sure how to interpret this, but all the queries I run in sql server 2005 have a "query cost (relative to batch)" of 100%. Is there any way to reduce the cost? ...

After importing sql files indexes in place, but not actually indexed

I imported all of our database to a new server. When I looked at the tables I see the indexes, but they all show a cardinality of 0. If I remove one index and add it back in, it triggers all the other indexes to run, but there's 180 tables. Is there a way to force all the tables to run their indexes? ...

Getting multiple index value from array

Hi all, i have created a string array from A-Z, which will contain index from 0-25. Then i have a textbox and when i enter text into the textbox, how can i get the index number of the array associated with the text i entered? For example, i enter "AB" into the textbox, the index return should be 0 and 1. The code below only able to r...

Creating indexes for optimizing the execution of Stored Prcocedures

Hi All, The WHERE clause of one of my queries looks like this: and tbl0.Type = 'Alert' AND (tbl0.AccessRights like '%'+TblCUG0.userGroup+'%' or tbl0.AccessRights like 'All' ) AND (tbl0.ExpiryDate > CONVERT(varchar(8), GETDATE(), 1) or tbl0.ExpiryDate is null) order by tbl0.Priority,tbl0.PublishedDate desc, tbl0.Title asc ...

Removing Error Indexes Google App Engine

Hi, I have been working on a google app engine project for a little while. I now have two Indexes that show status ERROR, and I think this is causing me to have other issues within my program. How do you remove these indexes? I have tried changing my datastore-indexes-auto.xml file but nothing has worked at removing these indexes. T...

Rails Postgres functional indexes

How I should enter my multicolum indexes which contain functions into schema.rb ? for example this DOESN'T work: add_index "temporary_events", ["templateinfoid", "campaign", "date(gw_out_time)", "messagetype"], :name => "temporary_events_campaign_tinfoid_date_messagetype" rake db:test:load rake aborted! PGError: ERROR: ...

Hibernate will not make indexes when creating tables from annotations

Hi, I'm using hibernate with hbm2ddl.auto=update so that it'll automatically generate my oracle tables for me (i've no intention of learning oracle's sql). So far, so good, until now i'm trying to get it to create an index. As far as i can tell, i've made my annotations correctly: package data; import javax.persistence.*; import org.hi...

mysql index size and duplicacy questions

Hello, I have a few general questions about database Index. Answers to any question are awaited: How to calculate total memory size occupied by an index. And is the size of index directly proportional to its Cardinality ? Do we need to index primary key, or is it indexed by its own. And how will it effect the memory and processing spe...

oci_bind_by_name use with

Hi all, Can you please help me understand something in this function? From the documentation, it says if I use function oci_bind_by_name and don't define the type, it will use the default SQLT_CHR. My question is how Oracle handles this variable. Imagine I do this for a select in a table which have an index in a field of type NUMBER. W...

Setting indexed columns on a custom SQL table

Hi, I've read about primary, unique, clustered indexes etc. But I need to understand it via an example. The image below is the auto-generated aspnet_Users table captured from SQL Server Web Admin Panel. Taking this as a model; I will create a custom table called Companies and let's say the fields are: ID, Name, ShortName, Address,...

Take N elements from sequence with N different indexes in F#

Hi, I'm new to F# and looking for a function which take N*indexes and a sequence and gives me N elements. If I have N indexes it should be equal to concat Seq.nth index0, Seq.nth index1 .. Seq.nth indexN but it should only scan over indexN elements (O(N)) in the sequence and not index0+index1+...+indexN (O(N^2)). To sum up, I'm looking...

Pointers and Indexes in Intel 8086 Assembly

I have a pointer to an array, DI. Is it possible to go to the value pointed to by both DI and another pointer? e.g: mov bl,1 mov bh,10 inc [di+bl] inc [di+bh] And, on a related note, is there a single line opcode to swap the values of two registers? (In my case, BX and BP?) ...

Index a subdirectory of DocumentRoot Apache

Hi there, I've the DocumentRoot with the Options +Indexes enabled. However, I cannot find via browser the subdirs of the DocumentRoot. How can I fix it? Thanks. ...

Django querysets indexes

I was wondering if using indexes on a model was possible: class Buildings(models.Model): island = models.ForeignKey(Island) townhall = models.IntegerField(default=1) lumberjack = models.IntegerField(default=0) stonequarry = models.IntegerField(default=0) ironmine = models.IntegerField(default=0) [...] a=Building...