mysql – Ligthen a DB for read speed

I am currently programming a software in Python with SQLAlchemy with MySQL. Since I am not really good in the database, I do not know exactly what term or configuration I am looking for, even though I have read a lot of documentation about it. I tried to look for information, but nothing really helped. I probably don't look with the good questions / terms.

So here is the situation I expect:

In one of my main tables I have 8 columns with 32 to 64 characters each. My software adds up to 2 million lines a year, and I want to keep them for statistics for more than 3 years, but I don't know how the number of lines affects execution speed. I will not change this data and will not always render all (on one website).

What should I do ? Is it really important to manipulate? Do I have to create and save something like new tables? Is there a term or somewhere I could find more information about my situation?

Thanks a lot

c ++ – How do I add a speed reedout in meters per second to my game?

I'm playing a boat racing game and want to display the speed of my boat in m / s, but I'm not sure how to do it. I move my boat to Frametime and my Moentum vector, which is based on thrust, drag, and my boat's previous monet.

I wonder if I have the length v | should calculate my Moentum vector, d. H. sqrt (MomentXX * MomentumX + MomentumZ * MomentumZ) and the multiplication * Frametime and * Set Scale

The set scale is a value that I have defined for my game, for example. 1 game unit: 1 meter. Would this be an approximation of my speed in meters per second or should I | v | multiply? Impulse through the frames per second instead? Any help would be appreciated.

Russia KVM Linux VPS with 200 Mbit / s speed Free facility Full root access – | Proxies-free

VPS9.Net has set itself the task of offering you the world's best services for your dream business. Your VPS will be up and running in a few minutes to get your website online. Our KVM Linux VPS will fully meet all of your business needs. We strive to offer you the best service 99.98% guaranteed uptime, a lightning fast network, 24/7 permanent support for one affordable and inexpensive.


FREE Instant setup

– Network – 200 Mbit / s

– Full root access

-24/7 Technical support

– –30 days money back guarantee

***************** Russia KVM VPS plans ****************


CPU – 1V core


RAM – 1024 MB

Network – 200 Mbit / s

Bandwidth – Unlimited

@ € 7.00 / month

Order now



CPU – 2V core


RAM – 2048 MB

Network – 200 Mbit / s

Bandwidth – Unlimited.

@ € 13.00 / month

Order now



CPU – 3V core


RAM – 3072 MB

Network – 200 Mbit / s

Bandwidth – Unlimited.

@ € 19.00 / month

Order now



CPU – 4V core


RAM – 4096 MB

Network – 200 Mbit / s

Bandwidth – Unlimited.

@ € 25.00 / month

Order now


If you are looking for Russia OpenVZ VPS … !! We offer Russia OpenVZ VPS

Learn more about Russia OpenVZ VPS

(Save 35% on Russia OpenVZ VPS)

Payment modules

Payza | Perfect money PayPal | Web Money | Bank Transfer

For more details Contact us

More updates can be found here



Network – Slow upload speed in any browser on Windows 10

I have slow upload speeds from any browser (Chrome, Firtefox, Opera, Edge) from 0.7 Mbit / s ~ 1.2 Mbit / s.
When using the Ookla CLI-Tool, the Windows Store Ookla Speedtest or the Android Speedtest (via WLAN) I get upload speeds of ~ 3.4 Mbit / s, which corresponds to what the ISP should deliver. The same behavior can be observed with other services (OK from any other app, slowly in browsers).

I am using Windows 10 Pro Build 1909, which is connected to the router with a 1 Gbit / s cable Ethernet connection.

Any ideas on how to fix this problem?

Unit – How can the speed be increased or increased at every 500 m away from the player?

`I'm actually a beginner,
and I create an endless runner game.
I want to increase the speed when the player has covered the distance and the speed should change every 500 meters
Any kind of idea to implement this kind of logic


// as soon as the player reaches 500 m away
// speed should be increased

There should be a continuous process every 500 m

terminal – macOS: Increases the speed at which accented characters are displayed when typing

Does anyone know how to increase the speed of the accent popup when typing on a Mac?

Example of an accent popup

I'm learning a new language that uses a lot of accents and I want the pop-up to be activated faster.

I'm sure there is a terminal command somewhere for it, but I've searched online and can't find anything!

(Picture stolen from another post)

Physics – How can you determine the speed as a function of the elongation of a spring when it hangs on a ceiling?

The problem is as follows:

A mass whose mass is $ m $ hangs vertically from a ceiling that is
tied to a spring that has a constant of $ K $ swings. Given
This state finds the speed as a function of the elongation of
the spring.

The alternatives given are as follows:

$ begin {array} {ll}
1. & sqrt { frac {K} {m} y ^ 2 + 2gy} \
2. & sqrt {2gy- frac {K} {m} y ^ 2} \
3. & sqrt { frac {K} {m} y ^ 2-2gy} \
4. & sqrt { frac {K} {m} y} \
5. & sqrt {2gy} \
end {array} $

How exactly should I find the speed in this situation? Could it be that a square root appears since then, which is related to the conservation of mechanical energy?

If so, it would be:

$ frac {1} {2} ky ^ {2} = frac {1} {2} mv ^ 2 $

Therefore in this situation it would be:

$ v = sqrt { frac {ky ^ {2}} {m}} $

But it doesn't appear in any of the alternatives. Which part I misunderstood. Can someone help me here?

Performance – Optimize the execution speed of Python

Hello, I recently wrote code in Python that does the following:

1.) Draws closing data from Yahoo Finance for x number of shares

2.) finds all possible combinations of x shares in groups of y size (i.e. all combinations of 13 shares in groups of 10)

3.) apply some calculations to each of these groups

4.) returns the optimal weights of each group. (Weights mean what percentage of the money should and must be invested in each share = 100%)

5.) Creates a data frame with all optimal portfolio weights (group weights)

My code works, but it is slow. Each loop on my PC takes an average of 2.45 seconds. This is fine for a small number of permutations as in the example above, but as the number of selections increases, so does the number of options. For example, a list of 30 stocks listed in unique groups of 15 has 155117520 ways my code would take over 12 years ….. I'm just looking for suggestions or instructions to speed up the execution of my code improve. I'm relatively new to coding, but I'm aware that Python is slower than other languages ​​in this task. At the moment, however, I only know a few Python basics. I'm using some for loops in this code that I know are slow, and instead I'm looking at using .apply () if you could help in any way it would be desirable.

import pandas as pd
from pandas_datareader import data
import datetime
import numpy as np
import random
import itertools
import requests
import time

time1 = time.time()

start = datetime.datetime(2015, 1, 1)

end = datetime.datetime(2019, 12, 31)

list2 = ()

num = ()

#################SP Download#######################

sptickers1 = ('MMM', 'ABT', 'ABBV', 'ABMD', 'ACN', 'ATVI', 'ADBE', 'AMD', 'AAP', 'AES', 'AFL', 'A', 'APD', 'AKAM', 'ALK', 'ALB', 'ARE', 'ALXN', 'ALGN', 'ALLE', 'AGN', 'ADS', 'LNT', 'ALL', 'GOOGL', 'GOOG', 'MO', 'AMZN', 'AMCR', 'AEE', 'AAL', 'AEP', 'AXP', 'AIG', 'T', 'AMT', 'AWK', 'AMP', 'ABC', 'AME', 'AMGN', 'APH', 'ADI', 'ANSS', 'ANTM', 'AON', 'AOS', 'APA', 'AIV', 'AAPL', 'AMAT', 'APTV', 'ADM', 'ARNC', 'ANET', 'AJG', 'AIZ', 'ATO', 'ADSK', 'ADP', 'AZO', 'AVB', 'AVY', 'BKR', 'BLL', 'BAC', 'BK', 'BAX', 'BDX', 'BBY', 'BIIB', 'BLK', 'BA', 'BKNG', 'BWA', 'BXP', 'BSX', 'BMY', 'AVGO', 'BR', 'CHRW', 'COG', 'CDNS', 'CPB', 'COF', 'CPRI', 'CAH', 'KMX', 'CCL', 'CAT', 'CBOE', 'CBRE', 'CDW', 'CE', 'CNC', 'CNP', 'CTL', 'CERN', 'CF', 'SCHW', 'CHTR', 'CVX', 'CMG', 'CB', 'CHD', 'CI', 'CINF', 'CTAS', 'CSCO', 'C', 'CFG', 'CTXS', 'CLX', 'CME', 'CMS', 'KO', 'CTSH', 'CL', 'CMCSA', 'CMA', 'CAG', 'CXO', 'COP', 'ED', 'STZ', 'COO', 'CPRT', 'GLW', 'CTVA', 'COST', 'COTY', 'CCI', 'CSX', 'CMI', 'CVS', 'DHI', 'DHR', 'DRI', 'DVA', 'DE', 'DAL', 'XRAY', 'DVN', 'FANG', 'DLR', 'DFS', 'DISCA', 'DISCK', 'DISH', 'DG', 'DLTR', 'D', 'DOV', 'DOW', 'DTE', 'DUK', 'DRE', 'DD', 'DXC', 'ETFC', 'EMN', 'ETN', 'EBAY', 'ECL', 'EIX', 'EW', 'EA', 'EMR', 'ETR', 'EOG', 'EFX', 'EQIX', 'EQR', 'ESS', 'EL', 'EVRG', 'ES', 'RE', 'EXC', 'EXPE', 'EXPD', 'EXR', 'XOM', 'FFIV', 'FB', 'FAST', 'FRT', 'FDX', 'FIS', 'FITB', 'FE', 'FRC', 'FISV', 'FLT', 'FLIR', 'FLS', 'FMC', 'F', 'FTNT', 'FTV', 'FBHS', 'FOXA', 'FOX', 'BEN', 'FCX', 'GPS', 'GRMN', 'IT', 'GD', 'GE', 'GIS', 'GM', 'GPC', 'GILD', 'GL', 'GPN', 'GS', 'GWW', 'HRB', 'HAL', 'HBI', 'HOG', 'HIG', 'HAS', 'HCA', 'PEAK', 'HP', 'HSIC', 'HSY', 'HES', 'HPE', 'HLT', 'HFC', 'HOLX', 'HD', 'HON', 'HRL', 'HST', 'HPQ', 'HUM', 'HBAN', 'HII', 'IEX', 'IDXX', 'INFO', 'ITW', 'ILMN', 'INCY', 'IR', 'INTC', 'ICE', 'IBM', 'IP', 'IPG', 'IFF', 'INTU', 'ISRG', 'IVZ', 'IPGP', 'IQV', 'IRM', 'JKHY', 'J', 'JBHT', 'SJM', 'JNJ', 'JCI', 'JPM', 'JNPR', 'KSU', 'K', 'KEY', 'KEYS', 'KMB', 'KIM', 'KMI', 'KLAC', 'KSS', 'KHC', 'KR', 'LB', 'LHX', 'LH', 'LRCX', 'LW', 'LVS', 'LEG', 'LDOS', 'LEN', 'LLY', 'LNC', 'LIN', 'LYV', 'LKQ', 'LMT', 'L', 'LOW', 'LYB', 'MTB', 'M', 'MRO', 'MPC', 'MKTX', 'MAR', 'MMC', 'MLM', 'MAS', 'MA', 'MKC', 'MXIM', 'MCD', 'MCK', 'MDT', 'MRK', 'MET', 'MTD', 'MGM', 'MCHP', 'MU', 'MSFT', 'MAA', 'MHK', 'TAP', 'MDLZ', 'MNST', 'MCO', 'MS', 'MOS', 'MSI', 'MSCI', 'MYL', 'NDAQ', 'NOV', 'NTAP', 'NFLX', 'NWL', 'NEM', 'NWSA', 'NWS', 'NEE', 'NLSN', 'NKE', 'NI', 'NBL', 'JWN', 'NSC', 'NTRS', 'NOC', 'NLOK', 'NCLH', 'NRG', 'NUE', 'NVDA', 'NVR', 'ORLY', 'OXY', 'ODFL', 'OMC', 'OKE', 'ORCL', 'PCAR', 'PKG', 'PH', 'PAYX', 'PAYC', 'PYPL', 'PNR', 'PBCT', 'PEP', 'PKI', 'PRGO', 'PFE', 'PM', 'PSX', 'PNW', 'PXD', 'PNC', 'PPG', 'PPL', 'PFG', 'PG', 'PGR', 'PLD', 'PRU', 'PEG', 'PSA', 'PHM', 'PVH', 'QRVO', 'PWR', 'QCOM', 'DGX', 'RL', 'RJF', 'RTN', 'O', 'REG', 'REGN', 'RF', 'RSG', 'RMD', 'RHI', 'ROK', 'ROL', 'ROP', 'ROST', 'RCL', 'SPGI', 'CRM', 'SBAC', 'SLB', 'STX', 'SEE', 'SRE', 'NOW', 'SHW', 'SPG', 'SWKS', 'SLG', 'SNA', 'SO', 'LUV', 'SWK', 'SBUX', 'STT', 'STE', 'SYK', 'SIVB', 'SYF', 'SNPS', 'SYY', 'TMUS', 'TROW', 'TTWO', 'TPR', 'TGT', 'TEL', 'FTI', 'TFX', 'TXN', 'TXT', 'TMO', 'TIF', 'TJX', 'TSCO', 'TT', 'TDG', 'TRV', 'TFC', 'TWTR', 'TSN', 'UDR', 'ULTA', 'USB', 'UAA', 'UA', 'UNP', 'UAL', 'UNH', 'UPS', 'URI', 'UTX', 'UHS', 'UNM', 'VFC', 'VLO', 'VAR', 'VTR', 'VRSN', 'VRSK', 'VZ', 'VRTX', 'V', 'VNO', 'VMC', 'WRB', 'WAB', 'WMT', 'WBA', 'DIS', 'WM', 'WAT', 'WEC', 'WFC', 'WELL', 'WDC', 'WU', 'WRK', 'WY', 'WHR', 'WMB', 'WLTW', 'WYNN', 'XEL', 'XRX', 'XLNX', 'XYL', 'YUM', 'ZBRA', 'ZBH', 'ZION', 'ZTS')

dstocks = sptickers1(0:13)

df = data.DataReader(dstocks, 'yahoo', start, end)('Close')

combinations = list(itertools.combinations(dstocks, 10))

combinationslist = ()

for i in combinations:

for i in combinationslist:

        start_time = time.time()

        df1 = df(i).copy()

        dfpct = df1.pct_change().apply(lambda x: np.log(x+1))

        sdd = dfpct.std()

        sda = sdd.apply(lambda x: x*np.sqrt(250))

        var = dfpct.var()

        cov_matrix = dfpct.cov()

        dfer = df1.resample('Y').last().pct_change()

        er = dfer.mean()

        p_ret = ()
        p_vol = ()
        p_weights = ()
        num_p = 1000

        for portfolio in range(num_p):
            n = len(i)
            weights = (random.random() for e in range(n))
            sum_weights = sum(weights)
            weights = (w/sum_weights for w in weights)
            returns =, er)
            p_var = cov_matrix.mul(weights, axis = 0).mul(weights, axis=1).sum().sum()
            p_sd = np.sqrt(p_var)
            p_sda = p_sd*np.sqrt(250)

        data = {'Returns':p_ret, 'Volatility':p_vol}

        for counter, symbol in enumerate(dfpct.columns.tolist()):
            data(symbol+ ' Weight') = (w(counter) for w in p_weights)

        portfolios = pd.DataFrame(data)

        rf = 0.02

        optimaln = ((portfolios('Returns')-rf)/portfolios('Volatility')).idxmax()

        optimal = portfolios.loc(optimaln)

        optimal1 = pd.DataFrame(optimal).transpose()

        optimal1I = optimal1.index.tolist()

        dictoptimal = portfolios.loc(optimal1I).to_dict(orient='records')


        end_time = time.time()

        print("total time taken this loop: ", end_time - start_time)

        print('Didnt work')
        num.append('didnt work')


fin = pd.DataFrame.from_dict(list2)

time2 = time.time()

print('program took ' + str(time2-time1) + ' Seconds')