mysql – How to speed up my SQL query?

I have a question that takes a lot longer than expected, and I do not see how to speed it up.

For a bit of background on the structure of the table, these are audited records. There is a parent record, which contains many child records. If a parent record is changed, an audit is written for it (but not for children). If a child record is changed, an audit record is written for the parent and the child (but not for the other children).

These two tables have an integer ID and a revision number. The child table also has a column for the parent ID. The way you access it is usually to select the parent record, and then the child records with the most recent revisions of the parent revision number are imported.

For example, if parent A has a revision of 100 and child B has records with revisions of 101, 98, and 90. Revision 98 will be imported for child B.

This is usually done parent by parent and the query is fast enough. I'm trying to make a similar query that will give me all the relevant IDs and revision numbers for each child. This is my request –

SELECT AS cId, MAX(c.REV) AS cRev FROM Parent_AUD p 
INNER JOIN Child_AUD c ON = c.parent_id AND p.REV >= c.REV

It takes more than 20 minutes to run (I never let it finish, so I do not know how long it takes exactly). There are about 2 million parent records and 13 million child records, which I do not know thought guarantees that a lot of time.

This is the release of EXPLAIN –

| id   | select_type | table  | type  | possible_keys                                      | key                         | key_len | ref                  | rows    | Extra                                        |
|    1 | SIMPLE      | parent | index | PRIMARY,FK_PARENT_REV                              | FK_PARENT_REV               | 4       | NULL                 | 2150722 | Using index; Using temporary; Using filesort |
|    1 | SIMPLE      | child  | ref   | FK_CHILD_REV,parent_id_index                       | parent_id_index             | 9       |         |      68 | Using where; Using index                     |

I have single-column indexes on the parent ID, the child ID, the parent revision number, the child revision number, and the parent ID in the child table.

Does anyone have any ideas on how I can speed up the process?

My website is facing speed issues, what should I do?

If your site is slow, the reason is that the content sent to the user is too large, the server is too slow, the client or the server calculates too much, slow content from a third party, putting poor caching, use of older software versions, failing network, over-sold resources, poor optimization, insufficient provisioning of resources, etc.

You can try to solve some of these problems by switching to a faster host using only NMVe or M2 SSDs with high I / O, caching all the memory contents with the help of Redis , by switching to a provider that only manufactures high quality versions and properly managing its systems. If a site takes more than one second, it is badly done and needs to be optimized.

How to speed up the production of this plot?

This is a follow-up question to this question. From these two answers, I can build the function sol(r)((1))(t0) as following:

Md = 10^(-9);
P = 10;
R = 10^4;
α = 10^(-2);
ϵ = 10^(-4);
γ = 10^(-2);
ke = 0.02*(1 + 0.6625);
k0 = 5*10^20;
σ = 5.67*10^-8;
Rg = 8315;
c = 3*10^8;
G = 6.67/10^11;
M = 2.8*10^30;

Ωk(r_) := Sqrt((G*M)/r^3);
μ = Md/(3*Pi);
κ = (27*ke)/(2*σ) Rg/μ;
ic = {Co(0) == 1, β(0) == 
    0, Σ(
     0) == (μ^(3/5)*Ωk(
         r)^(2/5)) (κ^(-1/5)*α^(-4/5)*Co(0)^(-1/5)),
   h(0) == (κ*α*Σ(0)^2*
   T(0) == (1/2)*(Ωk(r)*h(0))^2*(μ/
       Rg)*(1/(1 + β(0))),
   Kkr(0) == (k0*(Σ(0)*h(0)))/T(0)^(7/2)};

eq = {Σ'(
     t) == -Σ(
       t) + κ^(-1/5) α^(-4/5) μ^(3/
         5) Ωk(r)^(2/5)*Co(t)^(-1/5),
   h'(t) == -h(
       t) + (κ α Σ(t)^2 Ωk(
          r)^(-5) Co(t))^(1/6),
   T'(t) == -T(t) + 
     1/2 μ/Rg (Ωk(r)^2 h(t)^2)/(1 + β(t)),
   Kkr'(t) == -Kkr(t) + k0 Σ(t)/h(t)*T(t)^(-7/2),
     t) == -β(t) + μ/
       Rg (4 σ)/(3 c) T(t)^3/Σ(t) h(t),
   Co'(t) == -Co(t) + (1 + β(t))^4*(1 + Kkr(t)/ke)};

t0 = 20; sol = 
 ParametricNDSolveValue({eq, ic}, {Σ, h, 
   T}, {t, 0, t0}, {r})

Now I have to perform the following integral for a plot:

int(r_?NumericQ, t_?NumericQ) := sol(r)((1))(t0) r^3 Cos(2 CapitalOmega)k(r) t)
F1(t_?NumericQ) := NIntegrate(int(r, t), {r, 10^6, 10^8})
Plot(F1(t), {t, 0, 3*10^3})

In one night, this code did not produce the plot. I've tried with memoization for the function int:

 int(r_?NumericQ, t_?NumericQ) := int(r,t)=sol(r)((1))(t0) r^3 Cos(2 CapitalOmega)k(r) t)

but nothing has changed. I've tried it with ParallelTablebut Mathematica says that he can not communicate with the kernels (or something like that) and a simple Table(F1(t),{t,0,1000,100}) still has no output.

How can I produce the desired parcel?

Changing the ISO, aperture and shutter speed of the camera with android

The latest update of the FV-5 camera dates back to November 2017. Saying that it's a bit long in the tooth is a euphemism. It was only three months after the first public release of Android 8.0. Many reviews regarding the FV-5 camera are negative and indicate that it causes the blocking of many phones when accessing certain features. Your phone may not work completely with the FV-5 camera.

In "pro" mode, I could find the setting for ISO but not for aperture and shutter speed.

The shutter speed (exposure time) is to the right of ISO. The duration of exposure is currently 1/17 second.

enter the description of the image here

Very few smartphones allow control of the opening because the vast majority of smartphones do not have an adjustable aperture. The aperture in the lens is fixed. Most phone cameras that seem to allow "open control" simulate a change in aperture by using software to process images from two different cameras facing the same way.

As far as I know, the only smartphones with an adjustable aperture camera are the Samsung Galaxy S9, S9 +, Note 9 and the currently available Galaxy S10 and S10 +. They only have two points: two aperture settings, f / 1.5 and f / 2.4. The recently announced Galaxy Note 10 and Note 10+ include a three-step camera with f / 1.5, f / 1.8 and f / 2.4 formats.

On a numerical axis (One dimension), there are a lot of points, each point having a speed (left or right). Calculate the minimum time that two points meet

I have a question about this question. How can I calculate the minimum time for two points to meet in O (N) time.

All I can think of is a pair of calculation points and get the minimum.

Can any one give me hints?

How to increase the loading speed of the site? | Promotion Forum

If the speen loading site is not a problem related to your hosting, you can improve the loading speed of your site by using the image optimization plugin. I recommend smush. When you have a lot of images and video content, your website consumes a lot of resources and slows down your site. You must also limit plug-in uses and use a lightweight theme.

physics – Creation of a 2D billiard ball game, ball speed problem

I'm trying to create a simple program for a billiard game where two balls (a) and (b) having a radius (R) collide. I've created a python program and it's like that.

from math import sqrt, atan2, sin, cos, pi, inf
from numpy import array

W = 600  # width of the table
H = 300  # height of the table
R = 10  # the radius of the ball
A = 0  # decelration constant
dt = 10 ** -3
ma = mb = 1  # masses of the particles a and b

def vec_magnitude(V1):
    return sqrt(V1(0)**2 + V1(1)**2)

def collision_test(V1, V2):
    if vec_magnitude(V1 - V2) <= 2 * R:
        return True

def dot_product(V1, V2):
    return sum(V1 * V2)

def after_collision_velocity(Va, Vb, Ra, Rb):
    ''' the equation that produces the velocity of the objects after the collision'''
    Va_new = Va - ((2 * mb * dot_product(Va - Vb, Ra - Rb)) /
                ((ma + mb) * (vec_magnitude(Ra - Rb))**2) * (Ra - Rb))
    Vb_new = Vb - ((2 * ma * dot_product(Vb - Va, Rb - Ra)) /
                ((ma + mb) * (vec_magnitude(Rb - Ra))**2) * (Rb - Ra))
    return Va_new, Vb_new

def check_reflection(P, V_mag, angle, V):
    '''describing the motion of the ball'''
    if P(1) < R:
        P += array((0, 2 * (R - P(1))))
        angle *= -1
        return P, V_mag, angle, V
    if P(0) < R:
        P += array((2 * (R - P(0)), 0))
        angle = pi - angle
        return P, V_mag, angle, V
    if P(1) > H - R:
        P += array((0, 2 * (H - R - P(1))))
        angle *= -1
        return P, V_mag, angle, V
    if P(0) > W - R:
        P += array((2 * (W - R - P(0)), 0))
        angle = pi - angle
        return P, V_mag, angle, V
        V_mag -= A * dt
        Vx = V_mag * cos(angle)
        Vy = V_mag * sin(angle)
        P += array((Vx * dt, 0))
        P += array((0, Vy * dt))
        V = array((Vx, Vy))
        return P, V_mag, angle, V

file = open("test_drawing.txt", "w")
for line in open("data.txt", "r"):
    t = 0
    Xa, Ya, Xb, Yb, Vxa, Vya, Vxb, Vyb = (
        int(i) for i in (line.rstrip()).split(" "))
    Pa = array((Xa, Ya), dtype=float) #position vector of the ball a
    Pb = array((Xb, Yb), dtype=float) #position vector of the ball b
    Va = array((Vxa, Vya), dtype=float) #velocity vector of the ball a
    Vb = array((Vxb, Vyb), dtype=float) #velocity vector of the ball b
    Va_mag = vec_magnitude(Va)
    Vb_mag = vec_magnitude(Vb)
    if Vxa == 0:
        Vxa = inf
    angle_a = atan2(Vya, Vxa)
    if Vxb == 0:
        Vxb = inf
    angle_b = atan2(Vyb, Vxb)
    while t <= 10:
        Pa, Va_mag, angle_a, Va = check_reflection(Pa, Va_mag, angle_a, Va)
        Pb, Vb_mag, angle_b, Vb = check_reflection(Pb, Vb_mag, angle_b, Vb)
        if collision_test(Pa, Pb) == True:
            Va, Vb = after_collision_velocity(Va, Vb, Pa, Pb)
            Va_mag = vec_magnitude(Va)
            Vb_mag = vec_magnitude(Vb)
            if Va(0) == 0:
                Va(0) = inf
            angla_a = atan2(Va(1), Va(0))
            if Vb(0) == 0:
                Vb(0) = inf
            angle_b = atan2(Vb(1), Vb(0))
        t += dt
        file.write(str(Pa(0)) + " " + str(Pa(1)) + " " + str(Pb(0)) + " " + str(Pb(1)) + "n")
    print(Pa(0), Pa(1), Pb(0), Pb(1))

when I draw an image for a simple collision, that the data file would contain,

100 200 140 200 4 4 -4 4 Values, I get something like

enter the description of the image here

As you can see, the ball (b) bounces but not the ball (a). To determine the speed, I used the equation in the Wikipedia page of the elastic collision.

Can anyone understand why this is happening?

Do uppercase Dropboxs transfer speed?

Do uppercase Dropboxs transfer speed? | Talk Web Hosting

& # 39;);
var sidebar_align = & # 39; right & # 39 ;;
var content_container_margin = parseInt (& # 39; 350px & # 39;);
var sidebar_width = parseInt (& # 39; 330px & # 39;)
// ->

  1. Do uppercase Dropboxs transfer speed?

    I have a 1gig connection, get 700 Mbps backblaze download.
    Dropbox? 200
    And what makes me wonder if there is a strangulation is that the graph looks like a strangulation: peak at 700 then pushed back to 200.
    DB says the ISP is forming packets, but the ISP says no.
    How can I catch the bush?

Similar wires

  1. answers: 6

    Last post: 11-09-2004, 11:41 p.m.

  2. answers: 2

    Last post: 10-12-2004, 2:18 p.m.

  3. answers: 0

    Last post: 02-17-2004, 10:47 p.m.

  4. answers: 4

    Last post: 12-05-2003, 3:21 p.m.

  5. answers: 3

    Last post: 22-10-2002, 11:52

Tags for this thread

Authorizations to publish

  • You Maybe not post new discussions
  • You Maybe not post answers
  • You Maybe not post attachments
  • You Maybe not edit your posts

Do uppercase Dropboxs transfer speed?

I have a 1gig connection, get 700 Mbps backblaze download.
Dropbox? 200
And the thing that makes me wonder if there is an acceleration is that … | Read the rest of

collision detection – 2D thrust angle speed from top to bottom

I'm trying to determine the tilt angle of the NPCs when the PLAYER collides with them, as do 'Retro City Rampage'. and & # 39; Shakedown Hawaii & # 39; when you meet pedestrians.

enter the description of the image here

Here the PLAYER (green) arrives at an angle of -45, what is the formula or formula that I must use to decide the new angle that each NPC (red) should adopt?

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive New Proxy Lists Every Day Proxies123
Proxy Sites Proxy Tunnels Proxy List Working Proxy Sites Hotproxysite Proxy Sites Proxy Sites Anonymous Proxy Anonymous Proxies Proxy Servers Free Proxies Free Proxy List Proxy List Zoxy Proxy List PR liste all proxy sites More Proxies netgofree netgofree Hide-MyIp - The Best Proxy List American Proxy List Web Proxy Submit Proxies Updated Proxy List Updated Proxy List Bypass Proxy Sites Free Proxies List Evolving Critic Business Web Directory Free Proxy List iShortIt MyProxyList Online Proxies Go Proxies Need Proxies PrivateProxies Proxies4MySchool Proxies4Work Free Proxy List Free Proxy Sites ProxyInside Wiksa Proxy Free Proxy List ProxyNoid Proxy List Free Proxy List Proxy Sites Proxy TopList ProxyVille UK Proxy WebProxy List - Listing the best Web Proxies Free Proxy List SchoolProxiesList Stay Anonymous Proxy List The Power Of Ninja Proxy List UNubstruct Free proxy sites Free proxy sites