国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

java - trade-off between sql performance and high concurrency
PHP中文網(wǎng)
PHP中文網(wǎng) 2017-05-17 10:09:04
0
1
754

SELECT

        S.carOwnerID ,
        S.name,
        S.mobile,
        S.coopName,
        S.VIN,
        s.policyNO,
        S.effectiveDate,
        S.expiryDate,
        s.plateNo,
        (
            CASE
            WHEN s.num > 1 THEN
                1
            WHEN s.num = 1 THEN
                0
            END
        ) AS carState
    FROM
        (
            SELECT
                c.carOwnerID,
                c.name,
                c.mobile,
                c.coopName,
                c.VIN,
                p.policyNO,
                p.effectiveDate,
                p.expiryDate,
                c.plateNo,
                count(p.PlateNo) AS num
            FROM
                customer C
            LEFT JOIN policy P ON C.carOwnerID = P.carOwnerID
            WHERE
                date_add(
                    P.createTime,
                    INTERVAL 11.5 HOUR
                ) > NOW()
    
    ) s
    WHERE
        s.num > 0;

It is possible to simply use multi-table association. If you encounter high concurrency, performance defects will appear immediately

PHP中文網(wǎng)
PHP中文網(wǎng)

認(rèn)證0級講師

reply all(1)
漂亮男人

Multi-table association does not mean high performance of SQL. The efficiency loss of too complex SQL is no lower than external locks, etc., and there is no conflict with high concurrency.

It is recommended to split the statement into simple statements and use lock and compensation mechanisms to ensure transactionality.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template