optimization

optimize query with date type field in mysql

柔情痞子 提交于 2020-01-30 10:38:08
问题 I currently have the following query prepared: select sum(amount) as total from incomes where (YEAR(date) = '2019' and MONTH(date) = '07') and incomes.deleted_at is null when reviewing it a bit, notice that it takes too long to have a lot of data in the table, since it goes through all this. I do not know much about optimizing queries, but I want to start documenting and researching for this case, reading a little note that although it is possible to create an index for a date type field,

Access - Export images from Image controls in forms

∥☆過路亽.° 提交于 2020-01-30 01:03:25
问题 I have been searching for a way to extract images from access forms. A search on Google will nearly always point to OLEtoDisk. This software allows to export images stored in OLE fields inside access tables. This is not what I want. I have a form with some logos, headers and background images. Those images are making the database become bigger and bigger (because they are embedded in the form). I would extract them, place them on our server together with the back-end file and add them back to

Changing Large MySQL InnoDB Tables

筅森魡賤 提交于 2020-01-28 13:15:42
问题 Adding a new column or adding a new index can take hours and days for large innodb tables in MySQL with more than 10 million rows. What is the best way to increase the performance on large innodb tables in these two cases? More memory, tweaking the configuration (for example increasing the sort_buffer_size or innodb_buffer_pool_size), or some kind of trick? Instead of altering a table directly, one could create a new one, change it, and copy the old data the new, like this which is useful for

Why always close Database connection?

蹲街弑〆低调 提交于 2020-01-26 08:45:52
问题 If connecting to a database consumes a lot of resources, why should a database connection always be closed in your application if you have to open it again? Can I just make this connection available globally throughout my application so that other classes and methods can reuse it? For example (in pseudo code): public class PopulateGridViews() { public SqlConnection conn = new SqlConnection(@"Database:DATABASE"); conn.Open(); void PopulateGrid1() { SqlCommand cmd = new SqlCommand("SELECT *

How to improve SQL Server query containing nested sub query

大城市里の小女人 提交于 2020-01-26 04:35:16
问题 I was given this SQL query by my boss and told to improve/optimize it DECLARE @pol_0 int, @pol_1 int, @pol_2 int, @pol_3 int, @pol_4 int, @pol_5plus int, @peril_0 int, @peril_1 int, @peril_2 int, @peril_3 int, @peril_4 int, @peril_5plus int, @loc_1 int, @loc_2_10 int, @loc_11_100 int, @loc_101_1000 int, @loc_1001_5000 int, @loc_5001plus int, @locfass int, @polfass int, @pollim int, @polattpt int, @polded int, @maxded int, @polres int, @sublimit int, @sitelim int, @siteded int, @SS int, @WX

Pareto Front algorithm?

こ雲淡風輕ζ 提交于 2020-01-26 03:16:29
问题 I'm trying to find the non-dominated solutions of two vectors of random numbers, so that I can plot the Pareto frontier. Here's my code, but I'm currently very stuck so any help with where to go from here would be greatly appreciated :) x=rand(113,1) y=rand(113,1) x=sort(x, 'descend') v=[x,y] for i=1:113 m=max(v(i,2)) if v(i,2) > m n=max(v(i,2)) end end 来源: https://stackoverflow.com/questions/44036067/pareto-front-algorithm

Pareto Front algorithm?

孤街浪徒 提交于 2020-01-26 03:16:08
问题 I'm trying to find the non-dominated solutions of two vectors of random numbers, so that I can plot the Pareto frontier. Here's my code, but I'm currently very stuck so any help with where to go from here would be greatly appreciated :) x=rand(113,1) y=rand(113,1) x=sort(x, 'descend') v=[x,y] for i=1:113 m=max(v(i,2)) if v(i,2) > m n=max(v(i,2)) end end 来源: https://stackoverflow.com/questions/44036067/pareto-front-algorithm

Optimize connection between nodes in a graph [duplicate]

亡梦爱人 提交于 2020-01-25 20:58:56
问题 This question already has answers here : Connect nodes to maximize total edge weight (5 answers) Closed 2 years ago . I am working on a problem which could be reduced to a graph optimization problem as below. A set of colored nodes are given. A set of rules are given about the cost contribution from the nodes. Ex. If a red node is not connected, cost is 100 If a red node connects to red node, cost is 10 If a red node connects to a blue node, cost is 20 Any node can have only 4 connections at

Does A* need to know the optimal solution cost while utilizing an admissible heuristic?

删除回忆录丶 提交于 2020-01-25 20:27:07
问题 I've read through a few stackoverflows on this topic, as well as the wikipedia on A* but I'm still a little confused. I think this post almost explained it completely to me: A* heuristic, overestimation/underestimation? My only confusion left is, how does the A* know the optimal solution? It seems like with an admissible heuristic, you can throw out paths that exceed the known optimal solution, because the heuristic is guaranteed to be less than or equal. But how would A* know the optimal

How to handle A LOT of images in a webpage?

南笙酒味 提交于 2020-01-25 11:52:08
问题 So im making a website and i showed it to a fellow web developer. I want to make my website a "visual experience" and every page will have at least 30 50x 50 thumbnails, a 120 x 100 image, and a couple more thumbnails. it will a a members only page so you can image, the more register users, we will have MUCH MUCH more images. in fact, each member can have his/her own photo album, which will be another set of images. So he was really worried that my site would not be optimized and said that