indexing

Index scan for multicolumn comparison - non-uniform index column ordering

余生长醉 提交于 2019-12-19 10:24:36
问题 This question is closely related to Enforcing index scan for multicolumn comparison The solution there is perfect, but seems to works only if all index columns have same ordering. This question is different because column b is desc here, and this fact stops from using row-syntax to solve the same problem. This is why I'm looking for another solution. Suppose index is built for 3 columns (a asc, b DESC, c asc) , I want Postgres to: find key [a=10, b=20, c=30] in that B-tree, scan next 10

optimize tables for search using LIKE clause in MySQL

懵懂的女人 提交于 2019-12-19 10:18:46
问题 I am building a search feature for the messages part of my site, and have a messages database with a little over 9,000,000 rows, and and index on the sender , subject , and message fields. I was hoping to use the LIKE mysql clause in my query, such as (ex) SELECT sender , subject , message FROM Messages WHERE message LIKE '%EXAMPLE_QUERY%'; to retrieve results. unfortunately, MySQL doesn't use indexes when a leading wildcard is present , and this is necessary for the search query could appear

URL indexing in Google

*爱你&永不变心* 提交于 2019-12-19 10:07:33
问题 I want to check that a specific url is indexed in google using asp.net. Is google provide any api, webmethod anything regarding this. Please provide your comments if anybody know about this: Syed, 回答1: You can search Google for site:www.websiteyouwanttosearch.com and parse the results for this. 回答2: You could use Google's JSON/Atom Custom Search API to accomplish that. Search for a website's address like ?q=www.stackoverflow.com and if you get any results, it's indexed. To access this API in

unaccent() preventing index usage in Postgres

橙三吉。 提交于 2019-12-19 09:47:15
问题 I want to retrieve a way with a given name from an OpenStreetMap database imported into PostgreSQL 9.3.5, the OS is Win7 64-bit. In order to be a bit failure tolerant, I use the unaccent extension of Postgres. My query looks as follows: SELECT * FROM germany.ways WHERE lower(tags->'name') like lower(unaccent('unaccent','Weststrasse')) Query plan: Seq Scan on ways (cost=0.00..2958579.31 rows=122 width=465) Filter: (lower((tags -> 'name'::text)) ~~ lower(unaccent('unaccent'::regdictionary,

Access entries in pandas data frame using a list of indices

走远了吗. 提交于 2019-12-19 09:45:13
问题 I facing the issue that I need only a subset of a my original dataframe that is distributed over different rows and columns. E.g.: # My Original dataframe import pandas as pd dfTest = pd.DataFrame([[1,2,3],[4,5,6],[7,8,9]]) Output: 0 1 2 0 1 2 3 1 4 5 6 2 7 8 9 I can provide a list with rows and column indices where my desired values are located: array_indices = [[0,2],[1,0],[2,1]] My desired output is a series: 3 4 8 Can anyone help? 回答1: Use pd.DataFrame.lookup dfTest.lookup(*zip(*array

SOLR replication keeps downloading entire index from master

安稳与你 提交于 2019-12-19 09:42:23
问题 I have 2 slaves replicating from a master that has a 17GB index. I synced both slaves to this, AFTER which I set the poll interval to 60 seconds. One of the slaves tries to download the entire 17GB index even if only a tiny portion of it has changed. The other does not do this - it is able to get the latest index without this brute force sync. The redundant downloading causes me to exceed my disk space quota because it takes more than 60 seconds to download 17GB and solr kicks off a 2nd sync

Optimize performance for queries on recent rows of a large table

谁都会走 提交于 2019-12-19 09:33:20
问题 I have a large table: CREATE TABLE "orders" ( "id" serial NOT NULL, "person_id" int4, "created" int4, CONSTRAINT "orders_pkey" PRIMARY KEY ("id") ); 90% of all requests are about orders from the last 2-3 days by a person_id , like: select * from orders where person_id = 1 and created >= extract(epoch from current_timestamp)::int - 60 * 60 * 24 * 3; How can I improve performance? I know about Partitioning, but what about existing rows? And it looks like I need to create INHERITS tables

Sorting MongoDB GeoNear results by something other than distance?

試著忘記壹切 提交于 2019-12-19 09:02:53
问题 I'm developing a PHP application in which we need to retrieve results within a certain boundary, but ordered by the create date of the results, not the distance. I figured MongoDB's geoNear command would be great for this, since it takes care of calculating the distance for each result. However, I was wondering if there was a way to specify sorting by the create_date attribute, rather than distance. Ideally I would create a compound key index of coordinates and create date, and then quickly

Fast selection of a time interval in a pandas DataFrame/Series

霸气de小男生 提交于 2019-12-19 08:19:22
问题 my problem is that I want to filter a DataFrame to only include times within the interval [start, end) . If do not care about the day, I would like to filter only for start and end time for each day. I have a solution for this but it is slow. So my question is if there is a faster way to do the time based filtering. Example import pandas as pd import time index=pd.date_range(start='2012-11-05 01:00:00', end='2012-11-05 23:00:00', freq='1S').tz_localize('UTC') df=pd.DataFrame(range(len(index))

Fast selection of a time interval in a pandas DataFrame/Series

本秂侑毒 提交于 2019-12-19 08:19:20
问题 my problem is that I want to filter a DataFrame to only include times within the interval [start, end) . If do not care about the day, I would like to filter only for start and end time for each day. I have a solution for this but it is slow. So my question is if there is a faster way to do the time based filtering. Example import pandas as pd import time index=pd.date_range(start='2012-11-05 01:00:00', end='2012-11-05 23:00:00', freq='1S').tz_localize('UTC') df=pd.DataFrame(range(len(index))