indexing

Shall I define index (A) and index (B), or index (A, B), or both?

不羁岁月 提交于 2020-01-02 03:54:07
问题 In my table I have two closely related columns A and B. What possible considerations shall I made to decide whether to create: index(A) and index(B), index(A, B), both of the above? How does this change if I: use only queries like where A = 5 and B = 10 (and never like where A = 5 ), also use queries like where A > 3 and A < 10 and B > 12 and B < 20 , often use order by (A, B) , often use group by (A, B) ? Note: I intentionally haven't provided more details about my particular case as I want

How do you configure Lucene in Sitecore to only index the latest version of an item on the master db?

江枫思渺然 提交于 2020-01-02 03:29:27
问题 I recognise this is a moot point on the web database, so this question applies to the master db... I have a custom index set up in Sitecore 6.4.1 as follows: <index id="search_content_US" type="Sitecore.Search.Index, Sitecore.Kernel"> <param desc="name">$(id)</param> <param desc="folder">_search_content_US</param> <Analyzer ref="search/analyzer" /> <locations hint="list:AddCrawler"> <search_content_home type="Sitecore.Search.Crawlers.DatabaseCrawler, Sitecore.Kernel"> <Database>master<

Multilingual Search using lucene

南楼画角 提交于 2020-01-02 02:37:05
问题 I am doing a multilingual search. And I will use lucene as the tool to do it. I have the translated contents already, there will be 3 or 4 languages of each document. For indexing and search, there could be the 4 strategies, For each document/contents: each language are indexed in different index/directory. each language are indexed in different document but in the same index. each language are indexed in different Field but in the same document. all the languages are indexed in the same

Loose index scan in Postgres on more than one field?

Deadly 提交于 2020-01-02 02:01:07
问题 I have several large tables in Postgres 9.2 (millions of rows) where I need to generate a unique code based on the combination of two fields, 'source' (varchar) and 'id' (int). I can do this by generating row_numbers over the result of: SELECT source,id FROM tablename GROUP BY source,id but the results can take a while to process. It has been recommended that if the fields are indexed, and there are a proportionally small number of index values (which is my case), that a loose index scan may

Replace numpy matrix elements with submatrices

爷,独闯天下 提交于 2020-01-01 19:00:51
问题 Given that I have a square matrix of indices, such as: idxs = np.array([[1, 1], [0, 1]]) and an array of square matrices of the same size as each other (not necessarily the same size as idxs ): mats = array([[[ 0. , 0. ], [ 0. , 0.5]], [[ 1. , 0.3], [ 1. , 1. ]]]) I'd like to replace each index in idxs with the corresponding matrix in mats , to obtain: array([[ 1. , 0.3, 1. , 0.3], [ 1. , 1. , 1. , 1. ], [ 0. , 0. , 1. , 0.3], [ 0. , 0.5, 1. , 1. ]]) mats[idxs] gives me a nested version of

Google Search optimisation for ajax calls

喜夏-厌秋 提交于 2020-01-01 18:23:38
问题 I have a page on my site which has a list of things which gets updated frequently. This list is created by calling the server via jsonp, getting json back and transforming it into html. Fast and slick. Unfortunately, Google isn't able to index it. After reading up on how to get this done according to Google's AJAX crawling guide, I am bit confused and need some clarification and confirmation: The ajax pages need to be implement the rules only, right? I currently have a rest url like [site]

MySQL why logged as slow query/log-queries-not-using-indexes when have indexes?

断了今生、忘了曾经 提交于 2020-01-01 18:18:04
问题 Mysql 5.1.x in my.cnf: log-queries-not-using-indexes = 1 long_query_time = 30 and slow queries are logged Why I show this at log? Not slow and all fields are indexed. From mysql.slow.log: # Query_time: 0.001492 Lock_time: 0.000031 Rows_sent: 229 Rows_examined: 458 use database1; SET timestamp=1393342939; SELECT id,name FROM database1 ORDER BY name ASC; This table has 229 rows, MYISAM. id and name are indexed id = auto increment int unsigned name = varchar(255) utf-8 Can you explain why I show

MySQL why logged as slow query/log-queries-not-using-indexes when have indexes?

北战南征 提交于 2020-01-01 18:17:47
问题 Mysql 5.1.x in my.cnf: log-queries-not-using-indexes = 1 long_query_time = 30 and slow queries are logged Why I show this at log? Not slow and all fields are indexed. From mysql.slow.log: # Query_time: 0.001492 Lock_time: 0.000031 Rows_sent: 229 Rows_examined: 458 use database1; SET timestamp=1393342939; SELECT id,name FROM database1 ORDER BY name ASC; This table has 229 rows, MYISAM. id and name are indexed id = auto increment int unsigned name = varchar(255) utf-8 Can you explain why I show

Is there any benefit to creating and index on a primary key?

情到浓时终转凉″ 提交于 2020-01-01 16:51:08
问题 I checked this SO post: What's the difference between primary key, unique key, and index in MySQL? and found the statement: Also note that columns defined as primary keys or unique keys are automatically indexed in MySQL. Based on this, I have two questions: Am I safe in assuming that there is no performance benefit to creating an index on a primary key itself because the primary key, by design, is an index? Perhaps the more important question: If you are doing the classic example people cite

How do I estimate SQL Server index sizes

天大地大妈咪最大 提交于 2020-01-01 12:30:16
问题 While estimating straight row and table sizes are fairly simple math, we find it challenging to guess just how much space each index will occupy (for a given table size). What areas can we learn to calculate a better estimate and growth rate for indexes? 回答1: An index leaf has a preamble identifying the data page (7 bytes plus some directory information for variable length columns, if any) plus a copy of the key value (s) which will be the same size as the table data for those columns. There