2
votes
1answer
24 views

Optimizing indexes

I just began optimizing my schemas with indexes (pretty late I guess). I never dealt with huge dataset but I'll be soon coping with about 1 to 5 millions rows. Here is the schema I'm using right now ...
0
votes
1answer
27 views

Can't force mysql to use index

There are many similar questions about force index but mine is something different because i successfully use index at local dev server but can't on production server. I have a table with more than ...
1
vote
0answers
22 views

What is a loose index scan?

I was reading that MySQL can not use an index on 2 range conditions due to not having a "loose index scan" What exactly does this mean? Is it related to the underlying or the implementation of the ...
0
votes
1answer
24 views

How can I rewrite the following removing the date_format function?

I have a table with a column when that is of type datetime. I am doing the following filter which can not use and index: AND DATE_FORMAT(t1.when, '%Y-%m-%d') <= LAST_DAY(now() - interval 1 month ) ...
0
votes
2answers
67 views

Why is MySQL not using the index with the higher cardinality?

I have an index called source with cardinality of 1122 and a second index called state with cardinality of 22. MySQL keeps using the state index when when query SELECT C1 FROM tbl WHERE source = 'x' ...
-1
votes
0answers
18 views

MySQL indexing types? [closed]

i am newbie for php and mysql developement still don't make any indexing because don't have idea about that. how to use the mysql indexing. mostly used indexing method is what?
1
vote
1answer
23 views

What happens when CREATE INDEX gets interrupted (manually or accidentally)?

It takes hours or even days to create an index for a table of millions of rows. What happens to the database / data when CREATE INDEX gets interrupted? Such as when I manually used Ctrl-C or when ...
0
votes
1answer
34 views

Last used index from specific table

how can i take last used index from a specific table and add a +1 to it? database login, table cars I think i need to add it here #### $sql = 'INSERT INTO '.$this->options['db_table'] ...
0
votes
1answer
51 views

Why is this query slow, it seems simple

I have a very typical table of user information for my application, with an average set of columns (ints, varchars, etc). In this table are two varchar(100) fields: emailAddress and emailAddress2. ...
0
votes
3answers
57 views

How MongoDB indexes differs from MySQL indexes?

I am a newbie to MongoDB. I know how Indexes works and what it's importance in MySQL. Are MongoDB indexes are the same as MySQL ?
0
votes
2answers
25 views

MySQL Index for searching for NULL values in text fields

I need to do the simple query SELECT id FROM table WHERE blob_field IS NULL. blob_field is a longblob. If I create an index on blob_field with prefix length 1, will this be sufficient to use for ...
0
votes
2answers
26 views

MYSQL Indexes when looking up on alternating sets of columns

I have a table that looks like: CREATE TABLE `connections` ( `connection_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `service_id` smallint(5) unsigned DEFAULT NULL, `parent_id` bigint(20) ...
0
votes
1answer
45 views

Is searching an alternate index on a partitioned myISAM table concurrent or serial?

I have a myISAM table with 30 partitions. The primary key is a SHA1 hash value, which is also used in the partition selection function. I also have an alternate key - an autoincrement integer. Since ...
1
vote
1answer
42 views

What is a storage need for MySQL index on Varchar(100) in InnoDB?

I have a InnoDB table, which has EMail column (VARCHAR(100)), now I will run script which will hash some of that email addresses. I am wondering, if there is a difference in data storage (for example ...
0
votes
1answer
47 views

Optimize query to minimize tmp copying time

I have this mega query : SELECT s.eleve_id, crs.id_cours as 'cours_id', mc.code as cours_code, s.employe_id, s.id_seance, '0' as theorique, s.statut, s.type_vehicule_id, s.type_conduite_id, ...
0
votes
1answer
19 views

Request shown in slow logs

In my MYSQL configuration I activated logging of request not using indexes. slow_query_log=1 slow_query_log_file = /home/mysql/sqlprive.log long_query_time=7 log_queries_not_using_indexes =1 But ...
1
vote
2answers
145 views

Is it possible to index a computed column used in ORDER BY?

I am having problems with my mysql server, because of not properly written queries. I did not use indexes, because I do not know how to add them on computed columns, in a query that has SELECT ...
0
votes
1answer
132 views

Why are InnoDB's index keys limited to 767 bytes?

MySQL's official documentation states about InnoDB: An index key for a single-column index can be up to 767 bytes. The same length limit applies to any index key prefix. The meaning of this ...
0
votes
1answer
41 views

Best Indexing Strategy for Query with Equality[A], Range[B], Group By[C], AND Order By[count(P)]

I have a poorly performing query: SELECT user_id, count(item_id) as count FROM table items WHERE category = 'magazine' AND created_at > 1384754400 GROUP BY user_id ORDER BY count(item_id) desc ...
0
votes
0answers
32 views

What happens when an SSH session is terminated while a query is running?

I have a huge database on a dedicated server, whenever trying to modify the db I use PUTTY to establish an SSH connection and then do the work. Yesterday I started an INDEX query on an innodb table ...
-1
votes
1answer
89 views

Will the indexing affect insert/update/delete operation in Mysql [closed]

Will the indexing affect insert/update/delete operation in Mysql 5.1 Will it take down performance of insert update delete operations, If yes, why it will happen so. So are indexes always meant for ...
1
vote
2answers
62 views

Indexing varchar column to search for first letter

I'm trying to optimize a legacy web-app where users can ask for a list of all records whose name starts with a given character. The query to optimize is: SELECT oggetto.id_oggetto, titolo, anno, ...
1
vote
1answer
43 views

Is an explicit KEY redundant if it is covered by a UNIQUE KEY?

I am auditing an application which I've been developing over the course of several weeks. I've noticed this in CREATE TABLE: UNIQUE KEY `baz_3` (`baz`,`foo`,`bar`), KEY `baz` (`baz`), Is the ...
0
votes
1answer
43 views

Is ANALYZE useful immediately after creating an InnoDB index?

Let's create a new index on an existing table: CREATE INDEX `IDX_some_index` ON `some_table` (`a_column`, `another_column`); Is this useful? ANALYZE TABLE `some_table`; Can anyone point to ...
1
vote
1answer
89 views

UUID in mysql database

I have a problem, I have two servers where I have to save my data. For persistent data I run mySql inno DB. I have a lot of entries, so I need fast (CRUD operations). For indexing I was thinking to ...
0
votes
1answer
30 views

Should the value of a select max be indexed when the where clause is already indexed

I have a customer_orders table in a schema designed to be shared between multiple companies. Each customer_order has an invoice number that should always start at 1 and increment based on company ...
4
votes
3answers
80 views

StackExchange clone: where should I add my indexes?

I'm creating an open source stack exchange clone and the following is my schema. What should I add indexes on for it to be optimal? Here is the schema in Rails format (SQL format below as well): ...
1
vote
0answers
104 views

MySQL join query indexes

After recently discovering the MySQL feature to log queries that aren't using indexes, I've been chasing these down in a large app, looking for places to improve performance. There is at least one ...
1
vote
2answers
111 views

Adding index to large mysql tables

I have a table | base_schedule_line_items | CREATE TABLE base_schedule_line_items ( id int(10) unsigned NOT NULL AUTO_INCREMENT, installment int(10) unsigned NOT NULL, on_date date ...
0
votes
0answers
39 views

is it good to add index on column used in group by clause?

I have a query like- select x, sum(y) from xyz where z>=100 group by x order by sum(y) desc; will it be faster if I am going to add index on x?
0
votes
0answers
34 views

Group by clause giving temporary and filesort

I am using this simple select query which selects data from table inner joins and using group by clause. Here is the query ..I have defined indexes for the where clause and group by clause. But some ...
0
votes
2answers
100 views

mysql need help optimizing query

I have a table containing servers logs, and another table containing rules to match certain and drop them. The logs tables contains around 1 million rows, and there are about 20-30 rules. The ...
2
votes
1answer
112 views

mysql “Lock wait timeout exceeded” two transaction with different keys indexed

I have set of tables that I need to delete their records with a specific key and insert new records. Different transactions are used one for each key: Transaction 1: DELETE FROM table1 WHERE id=1; ...
1
vote
1answer
55 views

When is the index actually created?

I have noticed that even on huge tables with millions of records when I do a CREATE INDEX the index is created immediately (I get the console back in nsecs). Why is this? Doesn't it create the B-Tree ...
2
votes
1answer
93 views

Implications of a second index on a timestamp field in a sequential table

I have a MySQL table of a few gigabytes with roughly ~100M rows. I store data sequentially, such that the timestamps increase as the ID also increases. Because ordering and filtering by the timestamp ...
2
votes
1answer
147 views

MySQL InnoDB issue not using indexes correctly [Percona 5.6]

I just installed Percona 5.6 on my new CentOS 6.4 server. It's a fast machine 32 core xenon, 72GB ram, 8x SAS RAID 10 setup. So far so good My old server is a bit less powerful, and was running ...
0
votes
0answers
56 views

Understanding how MySQL indexes work

I'm reading this page but I can't get past the following parts: When all tables are processed, MySQL outputs the selected columns and backtracks through the table list until a table is found ...
0
votes
0answers
83 views

How does MySQL handle an index if its full size is too large for memory?

Let's assume this (totally artifical) query: select id from T where id%3=0 order by id desc; The index of T (InnoDB) is according to information_schema.tables sized 5 GB and T itself is 3 GB but ...
1
vote
1answer
64 views

How is the number of records on a select determined as high or low by optimizer?

What is the threshold between using the index and doing an direct access to the database? I assume this decision is related to the number of index access (and subsequent access to the tables). If this ...
1
vote
1answer
73 views

Mysql with index [closed]

I have this following sentence: SELECT Day(C.DataCadastro) AS Dia, Month(C.DataCadastro) AS Mes, Year(C.DataCadastro) AS Ano, COUNT(I.Plano) AS Total FROM clientes AS C ...
0
votes
1answer
41 views

Query when index is ready

To improve performance of a query I set up an in-memory table and fill it with data. Of course to increase speed I will use an index on the data stored in the in-memory table. create table helper ( ...
0
votes
1answer
99 views

How can I speed up a DateTime comparison query in MySQL?

I am performing the following query on a MySQL table with around a million records ( ~350MB ). It takes roughly 1.5 seconds every time. If I remove the OR last_updated > last_geocoded comparison, ...
1
vote
1answer
113 views

Using coalesce on an index column

Does doing a COALESCE on an indexed columns in a WHERE clause e.g. WHERE COALESCE(table1.indexed_column, '9999-01-01') > table2.other_date_column affect indexing in a bad way? I think that it ...
2
votes
2answers
298 views

MySQL - Add index to low cardinality text column?

I'm working on project where an enum column is being converted into a text column (I cannot change this). The cardinality of the column is low (7 unique values). Would I gain a performance increase by ...
0
votes
1answer
70 views

How to repair all indexes in a MySQL database?

My database got corrupted, and now the php app is throwing this error: Invalid query: Can't find FULLTEXT index matching the column list The error is not very useful, since it doesn't say what ...
0
votes
0answers
84 views

Using an enum as part of an index definition

When I use an ENUM column in a table the ORDER BY uses the ordinal of the ENUM not its value. I wasn't aware of that. So my question is what are the subtle issues when an ENUM is part of an index ...
0
votes
2answers
47 views

same field in bothe “where” and “order by” - how to index for this query?

The query: EXPLAIN EXTENDED SELECT *, u.user_id FROM xgate_geoloc g JOIN tig_users u ON g.uid = u.uid WHERE -- corners selection: ( ( ...
0
votes
3answers
199 views

Performance of primary key IDs with gaps (but in sequential order)

I know that having non-sequential IDs is bad for index performance. But assuming all my IDs are created in correct order, but with large gaps: i.e: 154300000 283700000 351300000 464200000 ...will ...
2
votes
1answer
637 views

MySQL requires FORCE INDEX on huge table and simple SELECTs

We have an application which stores articles from different sources in a MySQL table and allows users to retrieve those articles ordered by date. Articles are always filtered by source, so for client ...
0
votes
0answers
112 views

MySql INNER JOIN doesn't use composite index

I have two tables, table A which contains date and name of table B entry and table B which contains its name and type. Table a has a composite index on table_b_name and date. I'm selecting all table A ...