indexing

MySQL performance of query making addition of columns in where clause

回眸只為那壹抹淺笑 提交于 2020-01-15 11:17:44
问题 I have a query making an addition of several column values in the WHERE clause. I can't precompute this addition in a single column because the combination of columns to use varies between queries. My problem is that my table is very large (several hundreds of millions of rows) and the performances very bad. Example table: +---------+------------+--------+--------+--------+--------+ | tableId | categoryId | value1 | value2 | value3 | value4 | +---------+------------+--------+--------+--------

What is the way to add an index column in Dask when reading from a CSV?

為{幸葍}努か 提交于 2020-01-15 10:33:53
问题 I'm trying to process a fairly large dataset that doesn't fit into memory using Pandas when loading it at once so I'm using Dask. However, I'm having difficulty in adding a unique ID column to the dataset once read when using the read_csv method. I keep getting an error (see Code). I'm trying to create an index column so I can set that new column as the index for the data, but the error appears to be telling me to set the index first before creating the column. CODE df = dd.read_csv(r'path\to

select individual rows from multiindex pandas dataframe [duplicate]

人盡茶涼 提交于 2020-01-15 09:39:55
问题 This question already has answers here : Dynamically filtering a pandas dataframe (3 answers) Closed 2 years ago . I am trying to select individual rows from a multiindex dataframe using a list of multiindices. For example. I have got the following dataframe: Col1 A B C 1 1 1 -0.148593 2 2.043589 2 3 -1.696572 4 -0.249049 2 1 5 2.012294 6 -1.756410 2 7 0.476035 8 -0.531612 I would like to select all 'C' with (A,B) = [(1,1), (2,2)] Col1 A B C 1 1 1 -0.148593 2 2.043589 2 2 7 0.476035 8 -0

Excel VBA: how to solve Index and Match function type mismatch error

冷暖自知 提交于 2020-01-15 09:32:13
问题 I encounter error in index and match functions when the counter of date changes. I wrote a comment when I face with error. I uploaded a sample of my data if it needed. sample : http://s000.tinyupload.com/?file_id=00243748825638974221 here is the code : Sub regionalAverage() Application.ScreenUpdating = False Application.DisplayStatusBar = False Application.EnableEvents = False ActiveSheet.DisplayPageBreaks = False ' *** change the declaration here *** Dim aname() As String Dim rw As Variant

How find greatest tuple before given 2-column tuple in postgres fast

非 Y 不嫁゛ 提交于 2020-01-15 09:23:47
问题 How to increase select statement speed in Postgres 9.0 ? Table has required index present. Desired result can obtained using index (kuupaev,kellaaeg) immediately. However Postgres scans all rows: explain analyze SELECT max( kuupaev||kellaaeg ) as res from firma2.ALGSA where laonr=1 and kuupaev <=current_date and (kuupaev,kellaaeg) <= ( current_date, '23 59' ) "Aggregate (cost=6932.65..6932.67 rows=1 width=10) (actual time=1608.590..1608.592 rows=1 loops=1)" " -> Seq Scan on algsa (cost=0.00.

Solr DataImportHandler doesn't work with XML Files

本小妞迷上赌 提交于 2020-01-15 07:24:06
问题 I'm very new to Solr. I succeeded in indexing data from my sql database via DIH. Now I want to import xml files and index them also via DIH but it just won't work! My data-config.xml looks like this: <dataConfig> <dataSource type="FileDataSource" encoding="UTF-8" /> <document> <entity name="dir" processor="FileListEntityProcessor" baseDir="/bla/test2" fileName=".*xml" stream="true" recursive="false" rootEntity="false"> <entity name="PubmedArticle" processor="XPathEntityProcessor" transformer=

Matlab - select all rows starting with a particular number

╄→гoц情女王★ 提交于 2020-01-15 07:08:41
问题 Say I have a matrix A, and I want to construct a matrix B that contains all rows of B that start with a particular number. How? Thanks 回答1: Select all rows of B into A, where the first colum of B has value n: A = B(B(:,1) == n,:); In contrast to that, the following selects all rows of B into A, starting from row index n: A = B(n:end,:); 来源: https://stackoverflow.com/questions/5561007/matlab-select-all-rows-starting-with-a-particular-number

Matlab - select all rows starting with a particular number

别说谁变了你拦得住时间么 提交于 2020-01-15 07:08:10
问题 Say I have a matrix A, and I want to construct a matrix B that contains all rows of B that start with a particular number. How? Thanks 回答1: Select all rows of B into A, where the first colum of B has value n: A = B(B(:,1) == n,:); In contrast to that, the following selects all rows of B into A, starting from row index n: A = B(n:end,:); 来源: https://stackoverflow.com/questions/5561007/matlab-select-all-rows-starting-with-a-particular-number

Swapping element in an array

人走茶凉 提交于 2020-01-15 03:16:09
问题 I've been trying to work this out: Say I have an array: int[] n = {0, 0, -1, 1, 0, 1, 1, -1, 1}; I need to be able to sort through the array and if there is a zero with a non zero preceding it, then they should be swapped. For example: 0, 0, -1, 1, 0, 1, 1, -1, 1 will become: 0, 0, -1, 0, 1, 1, 1, -1, 1 I have been trying to do it using a for loop and if statements with no luck. Any tips? 回答1: Try this: for (int i = 1 ; i < n.length ; i++) if (n[i] == 0 && n[i - 1] != 0) { int tmp = n[i - 1];

Swapping element in an array

谁说胖子不能爱 提交于 2020-01-15 03:16:07
问题 I've been trying to work this out: Say I have an array: int[] n = {0, 0, -1, 1, 0, 1, 1, -1, 1}; I need to be able to sort through the array and if there is a zero with a non zero preceding it, then they should be swapped. For example: 0, 0, -1, 1, 0, 1, 1, -1, 1 will become: 0, 0, -1, 0, 1, 1, 1, -1, 1 I have been trying to do it using a for loop and if statements with no luck. Any tips? 回答1: Try this: for (int i = 1 ; i < n.length ; i++) if (n[i] == 0 && n[i - 1] != 0) { int tmp = n[i - 1];