Datatable Very Slow Loading

Datatable Very Slow Loading

binexlinebinexline Posts: 27Questions: 10Answers: 0

Hello,

I have a datatable, that fetches maximum 10,000 rows of data from a remote SQL server.
It takes about 14sec for the table to load 950 entries.. where TTFB alone took 13sec.
Can anyone... please guide me how I could reduce this time...?

Below is my table:

            $('#mblList').DataTable({
            "dom": 'Blfrtip',
            ajax: "data.php",
            columns: [{
                    data: 'ROWNUM',
                    className: 'not-editable'
                },
                {
                    data: function(row, type, val, meta) {
                        if (row.BLOCK == 'HF') return 'Y';

                        return '';
                    },
                    "name": "Block",
                    className: 'text-danger not-editable'
                },
                {
                    data: 'REF_NO',
                    className: 'not-editable'
                },
                {
                    data: 'MBL_NO',
                    className: 'not-editable'
                },
                {
                    data: null,
                    render: function(data, type, row) {
                        if (data.BLOCK == 'HF') return '';
                        return '<button type="button" class="btn btn-dark btn-sm">HC</button>';
                    },
                    className: 'HC not-editable'
                },
                {
                    data: null,
                    render: function(data, type, row) {
                        return '<button type="button" class="btn btn-dark btn-sm">View</button>';
                    },
                    className: 'View not-editable'
                },
                {
                    data: 'SHP_MOD',
                    className: 'not-editable'
                },
                {
                    data: 'OFC',
                    className: 'not-editable'
                },
                {
                    data: 'CARR_BKG_NO',
                    className: 'not-editable'
                },
                {
                    data: 'HBL_CNT',
                    className: 'not-editable'
                },
                {
                    data: 'ETD',
                    className: 'not-editable'
                },
                {
                    data: 'ETA',
                    className: 'not-editable'
                },
                {
                    data: 'DOC_CUT_OFF_DT',
                    className: 'not-editable'
                },
                {
                    data: 'VGM_CUT_OFF_DT',
                    className: 'not-editable'
                },
                {
                    data: function(row, type, val, meta) {
                        if (row.CNTR_CNT > 0) return row.CNTR_NO + ' + ' + row.CNTR_CNT;

                        return row.CNTR_NO;
                    },
                    "name": "Container",
                    className: 'not-editable'
                },
                {
                    data: 'CNTR_SUMMARY',
                    className: 'not-editable'
                },
                {
                    data: 'FORWARDING_AGENT',
                    className: 'not-editable'
                },
                {
                    data: 'DEST_AGENT',
                    className: 'not-editable'
                },
                {
                    data: 'TRIANGLE_AGENT',
                    className: 'not-editable'
                },
                {
                    data: 'SHIPPER',
                    className: 'not-editable'
                },
                {
                    data: 'CNEE',
                    className: 'not-editable'
                },
                {
                    data: 'BILLING_CARRIER',
                    className: 'not-editable'
                },
                {
                    data: 'VSL_NM',
                    className: 'not-editable'
                },
                {
                    data: 'VOY',
                    className: 'not-editable'
                },
                {
                    data: 'CARRIER',
                    className: 'not-editable'
                },
                {
                    data: 'POR',
                    className: 'not-editable'
                },
                {
                    data: 'POL',
                    className: 'not-editable'
                },
                {
                    data: 'POD',
                    className: 'not-editable'
                },
                {
                    data: 'DEL',
                    className: 'not-editable'
                },
                {
                    data: 'PIKUP_DT',
                    className: 'not-editable'
                },
                {
                    data: 'RLSD_FLG',
                    render: function(data, type, row) {
                        if (type === 'display') {
                            if (data == "Y") return '<i class="fas fa-check-square"></i> <i class="fa fa-pencil edit"/>';
                            else return '<i class="far fa-square"></i> <i class="fa fa-pencil edit"/>';
                        }
                        return data;
                    }
                },
                {
                    data: 'RLSD_DT',
                    render: editIcon
                },
                {
                    data: 'FRT',
                    className: 'not-editable'
                },
                {
                    data: 'AR',
                    className: 'not-editable'
                },
                {
                    data: 'AP',
                    className: 'not-editable'
                },
                {
                    data: 'DC',
                    className: 'not-editable'
                },
                {
                    data: 'CUST_REF_NO',
                    className: 'not-editable'
                },
                {
                    data: 'VERIFY',
                    className: 'not-editable'
                },
                {
                    data: 'PAY',
                    className: 'not-editable'
                },
                {
                    data: 'ISSUED_BY',
                    className: 'not-editable'
                },
                {
                    data: 'SALES_PIC',
                    className: 'not-editable'
                },
                {
                    data: 'POST_DT',
                    className: 'not-editable'
                },
                {
                    data: 'AGENT_REF_NO',
                    className: 'not-editable'
                },
                {
                    data: 'A_EDI',
                    className: 'not-editable'
                },
                {
                    data: 'RGST_TMS',
                    className: 'not-editable'
                },
                {
                    data: 'MODI_USR_NM',
                    className: 'not-editable'
                },
                {
                    data: 'MODI_TMS',
                    className: 'not-editable'
                }
            ],
            "deferRender": true,
            "scrollX": true,
            "scrollY": '65vh',
            "scrollCollapse": true,
            select: {
                style: 'api'
            },
            processing: true,
            "pageLength": 200,
            "lengthMenu": [
                [200, 300, 500, 1000, -1],
                [200, 300, 500, 1000, "All"]
            ],
            buttons: [{
                extend: "excel",
                text: 'Excel All'
            }, {
                extend: "remove",
                editor: editor
            }],
            keys: {
                columns: ':not(.HC, .View)',
                blurable: false
            },
            initComplete: function() {
                // Apply the search
                this.api().columns().every(function() {
                    var that = this;

                    $('input', this.footer()).on('keyup change clear', function() {
                        if (that.search() !== this.value) {
                            that
                                .search(this.value)
                                .draw();
                        }
                    });
                });
            }
        });

And below is my data.php

This question has accepted answers - jump to:

Answers

  • binexlinebinexline Posts: 27Questions: 10Answers: 0

    And below is my data.php
    When I execute below query from for example SSMS, it only takes 4sec to get the results
    Also please ignore the " from below code, I kinda edited the Query.php file for " to work as '..:) (I forgot why I did that)

    // DataTables PHP library
    include("../../../vendor/Editor-PHP-1.9.6/lib/DataTables.php");
    
    // Alias Editor classes so they are easy to use
    use
        DataTables\Editor,
        DataTables\Editor\Field,
        DataTables\Editor\Format;
    
    // Build our Editor instance and process the data coming from _POST
    $editor = Editor::inst($db, 'TB_INTG_BL as BL', array('INTG_BL_SEQ', 'RGST_OFC_CD'))
        ->fields(
            Field::inst('ROW_NUMBER() OVER (ORDER BY BL.POST_DT DESC, BL.MODI_TMS DESC)', 'ROWNUM'),
            Field::inst('BL.INTG_BL_SEQ', 'INTG_BL_SEQ'),
            Field::inst('BL.BL_NO', 'MBL_NO'),
            Field::inst('BL.REF_NO', 'REF_NO'),
            Field::inst('BL.REF_OFC_CD', 'OFC'),
            Field::inst('OFC.OFC_ADDR', 'OFC_ADDR'),
            Field::inst('OFC.OFC_LOCL_NM', 'OFC_NAME'),
            Field::inst('OFC.OFC_PHN', 'OFC_PHN'),
            Field::inst('OFC.OFC_FAX', 'OFC_FAX'),
            Field::inst('OFC.DOCK_RCPT_RMK', 'REMARK'),
            Field::inst('BL.LNR_BKG_NO', 'CARR_BKG_NO'),
            Field::inst('BL.ETD_DT_TM', 'ETD')
                ->getFormatter(Format::dateSqlToFormat('m-d-Y'))
                ->setFormatter(Format::dateFormatToSql('Ymd')),
            Field::inst('BL.ETA_DT_TM', 'ETA')
                ->getFormatter(Format::dateSqlToFormat('m-d-Y'))
                ->setFormatter(Format::dateFormatToSql('Ymd')),
            Field::inst('BL.POR_NM', 'POR'),
            Field::inst('BL.POL_NM', 'POL'),
            Field::inst('LOC_POL.UN_LOC_CD', 'POL_UN_LOC_CD'),
            Field::inst('BL.POD_NM', 'POD'),
            Field::inst('LOC_POD.UN_LOC_CD', 'POD_UN_LOC_CD'),
            Field::inst('BL.DEL_NM', 'DEL'),
            Field::inst('BL.OBRD_DT_TM', 'ONBOARD')
                ->getFormatter(Format::dateSqlToFormat('m-d-Y'))
                ->setFormatter(Format::dateFormatToSql('Ymd')),
            Field::inst('(SELECT MAX(X.CNTR_NO) FROM TB_CNTR_LIST X WHERE X.INTG_BL_SEQ = BL.INTG_BL_SEQ AND X.DELT_FLG = "N")', 'CNTR_NO'),
            Field::inst('(SELECT COUNT(X.CNTR_NO) - 1 FROM TB_CNTR_LIST X WHERE X.INTG_BL_SEQ = BL.INTG_BL_SEQ AND X.DELT_FLG = "N")', 'CNTR_CNT'),
            Field::inst('BL.CNTR_INFO', 'CNTR_SUMMARY'),
            Field::inst('BL.PCK_QTY', 'PCK_QTY'),
            Field::inst('BL.MK_TXT', 'MARK'),
            Field::inst('BL.SAD_TXT', 'SAD_TXT'),
            Field::inst('BL.DESC_TXT', 'DESCRIPTION'),
            Field::inst('BL.CLEAN_ON_BOARD', 'CLEAN_ON_BOARD'),
            Field::inst('BL.LNR_RMK', 'LNR_RMK'),
            Field::inst('BL.MK_GRS_WGT', 'KGS'),
            Field::inst('BL.MK_GRS_WGT1', 'LBS'),
            Field::inst('BL.MK_MEAS', 'CBM'),
            Field::inst('BL.MK_MEAS1', 'CFT'),
            Field::inst('BL.FRT_TERM_CD', 'FRT_TERM_CD'),
            Field::inst('BL.OBL_TP_CD', 'OBL_TP_CD'),
            Field::inst('BL.FM_SVC_TERM_CD', 'MOVE_TYPE_FM_CD'),
            Field::inst('BL.TO_SVC_TERM_CD', 'MOVE_TYPE_TO_CD'),
            Field::inst('BL.ITN_NO', 'ITN_NO'),
            Field::inst('AGENT.TRDP_NM', 'FORWARDING_AGENT'),
            Field::inst('AGENT.TRDP_ADDR', 'FORWARDING_AGENT_ADDR'),
            Field::inst('PRNR.TRDP_NM', 'DEST_AGENT'),
            Field::inst('PRNR.TRDP_ADDR', 'DEST_AGENT_ADDR'),
            Field::inst('PRNR2.TRDP_NM', 'TRIANGLE_AGENT'),
            Field::inst('SHPR.TRDP_NM', 'SHIPPER'),
            Field::inst('SHPR.TRDP_ADDR', 'SHIPPER_ADDR'),
            Field::inst('SHPR_CNT.CNT_ENG_NM', 'SHIPPER_CNT'),
            Field::inst('CNEE.TRDP_NM', 'CNEE'),
            Field::inst('CNEE.TRDP_ADDR', 'CNEE_ADDR'),
            Field::inst('NOTIFY.TRDP_NM', 'NOTIFY'),
            Field::inst('NOTIFY.TRDP_ADDR', 'NOTIFY_ADDR'),
            Field::inst('LNR.TRDP_NM', 'CARRIER'),
            Field::inst('CARR.TRDP_NM', 'BILLING_CARRIER'),
            Field::inst('BL.SHP_MOD_CD', 'SHP_MOD'),
            Field::inst('(SELECT MAX(X.ENG_USR_NM) FROM TB_USR X WHERE X.USR_TP = "I" AND X.USRID = BND.ISSUED_BY)', 'ISSUED_BY'),
            Field::inst('BL.POST_DT', 'POST_DT')
                ->getFormatter(Format::dateSqlToFormat('m-d-Y'))
                ->setFormatter(Format::dateFormatToSql('Ymd')),
            Field::inst('BL.TRNK_VSL_NM', 'VSL_NM'),
            Field::inst('BL.TRNK_VOY', 'VOY'),
            Field::inst('(SELECT COUNT(*) FROM TB_INTG_BL_RLT RLT WHERE RLT.RLT_INTG_BL_SEQ = BL.INTG_BL_SEQ AND RLT.DELT_FLG = "N")', 'HBL_CNT'),
            Field::inst('BL.RLSD_FLG', 'RLSD_FLG'),
            Field::inst('BL.RLSD_DT_TM', 'RLSD_DT')
                ->getFormatter(Format::dateSqlToFormat('m-d-Y'))
                ->setFormatter(Format::dateFormatToSql('Ymd')),
            Field::inst('ISNULL(BLCK.BL_STS_CD1, BL.BL_STS_CD)', 'BLOCK'), // if BLOCK = HF, blocked
            Field::inst('ISNULL(BND.AR_CHK,"X")', 'AR'),
            Field::inst('ISNULL(BND.AP_CHK,"X")', 'AP'),
            Field::inst('ISNULL(BND.DC_CHK,"X")', 'DC'),
            Field::inst('ISNULL(BND.FRT_CHK,"X")', 'FRT'),
            Field::inst('BL.DOC_CUT_OFF_DT', 'DOC_CUT_OFF_DT')
                ->getFormatter(Format::dateSqlToFormat('m-d-Y H:i'))
                ->setFormatter(Format::dateFormatToSql('YmdHi')),
            Field::inst('ISNULL(BND.VGM_CUT_OFF_DT,"")', 'VGM_CUT_OFF_DT')
                ->getFormatter(Format::dateSqlToFormat('m-d-Y H:i'))
                ->setFormatter(Format::dateFormatToSql('YmdHi')),
            Field::inst('BND.SLS_USR_NM', 'SALES_PIC'),
            Field::inst('BL.MODI_USR_NM', 'MODI_USR_NM'),
            Field::inst('BL.CUST_REF_NO', 'CUST_REF_NO'),
            Field::inst('BND.VERIFY_FLAG', 'VERIFY'),
            Field::inst('BND.PAY_FLAG', 'PAY'),
            Field::inst('BL.MODI_TMS', 'MODI_TMS')
                ->getFormatter(Format::dateSqlToFormat('m-d-Y H:i'))
                ->setFormatter(Format::dateFormatToSql('Y-m-d H:i:s.u')),
            Field::inst('BL.RGST_TMS', 'RGST_TMS')
                ->getFormatter(Format::dateSqlToFormat('m-d-Y H:i'))
                ->setFormatter(Format::dateFormatToSql('Y-m-d H:i:s.u')),
            Field::inst('ISNULL(BND.PKUP_DT, "")', 'PIKUP_DT')
                ->getFormatter(Format::dateSqlToFormat('m-d-Y'))
                ->setFormatter(Format::dateFormatToSql('Ymd')),
            Field::inst('BL.PRNR_REF_NO', 'AGENT_REF_NO'),
            Field::inst('(SELECT COUNT(*) FROM TB_EDI_SND_HIS WHERE EDI_MSG_NO LIKE "AGT%" AND EDI_MSG_TXT LIKE "%" + BL.INTG_BL_SEQ + "%")', 'A_EDI')
                ->getFormatter(function ($val, $data) {
                    if ($data['PRNR.TRDP_NM'])
                        return $val > 0
                            ? 'Y'
                            : 'N';
                    return 'X';
                })
        )
        ->leftJoin('TB_ADD_INFO_BND as BND', 'BL.INTG_BL_SEQ', '=', 'BND.INTG_BL_SEQ')
        ->leftJoin('TB_BL_PRNR as PRNR', 'BL.INTG_BL_SEQ', '=', 'PRNR.INTG_BL_SEQ AND PRNR.BL_TRDP_TP_CD = "P01" AND PRNR.DELT_FLG = "N"')
        ->leftJoin('TB_BL_PRNR as PRNR2', 'BL.INTG_BL_SEQ', '=', 'PRNR2.INTG_BL_SEQ AND PRNR2.BL_TRDP_TP_CD = "P03" AND PRNR2.DELT_FLG = "N"')
        ->leftJoin('TB_BL_PRNR as AGENT', 'BL.INTG_BL_SEQ', '=', 'AGENT.INTG_BL_SEQ AND AGENT.BL_TRDP_TP_CD = "A01" AND AGENT.DELT_FLG = "N"')
        ->leftJoin('TB_BL_PRNR as SHPR', 'BL.INTG_BL_SEQ', '=', 'SHPR.INTG_BL_SEQ AND SHPR.BL_TRDP_TP_CD = "S01" AND SHPR.DELT_FLG = "N"')
        ->leftJoin('TB_TRDP as SHPR_TRDP', 'SHPR_TRDP.TRDP_CD', '=', 'SHPR.TRDP_CD')
        ->leftJoin('TB_CNT as SHPR_CNT', 'SHPR_CNT.CNT_CD', '=', 'SHPR_TRDP.CNT_CD')
        ->leftJoin('TB_BL_PRNR as CNEE', 'BL.INTG_BL_SEQ', '=', 'CNEE.INTG_BL_SEQ AND CNEE.BL_TRDP_TP_CD = "C01" AND CNEE.DELT_FLG = "N"')
        ->leftJoin('TB_BL_PRNR as NOTIFY', 'BL.INTG_BL_SEQ', '=', 'NOTIFY.INTG_BL_SEQ AND NOTIFY.BL_TRDP_TP_CD = "N01" AND NOTIFY.DELT_FLG = "N"')
        ->leftJoin('TB_BL_PRNR as LNR', 'BL.INTG_BL_SEQ', '=', 'LNR.INTG_BL_SEQ AND LNR.BL_TRDP_TP_CD = "L01" AND LNR.DELT_FLG = "N"')
        ->leftJoin('TB_BL_PRNR as CARR', 'BL.INTG_BL_SEQ', '=', 'CARR.INTG_BL_SEQ AND CARR.BL_TRDP_TP_CD = "B01" AND CARR.DELT_FLG = "N"')
        ->leftJoin('(SELECT INTG_BL_SEQ AS INTG_BL_SEQ1, BL_STS_CD AS BL_STS_CD1 FROM TB_INTG_BL_BLCK) as BLCK', 'BL.INTG_BL_SEQ', '=', 'BLCK.INTG_BL_SEQ1')
        ->leftJoin('TB_OFC as OFC', 'BL.REF_OFC_CD', '=', 'OFC.OFC_CD AND OFC.DELT_FLG = "N"')
        ->leftJoin('TB_LOC as LOC_POL', 'LOC_POL.LOC_CD', '=', 'BL.POL_CD')
        ->leftJoin('TB_LOC as LOC_POD', 'LOC_POD.LOC_CD', '=', 'BL.POD_CD')
        ->where('BND.BND_CLSS_CD', 'O')
        ->where('BND.DELT_FLG', 'N')
        ->where('BL.DELT_FLG', 'N')
        ->where('BL.AIR_SEA_CLSS_CD', 'S')
        ->where('BL.BIZ_CLSS_CD', 'M');
    
    $editor->process($_POST)
        ->json();
    
  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    This section of the FAQ should help, it discusses various techniques to improve performance,

    Cheers,

    Colin

  • binexlinebinexline Posts: 27Questions: 10Answers: 0

    Hi @colin ,

    Thanks for the reference. But paging is set true, draw performance is fine, and deferRender is set true also. (my table is ajax sourced)
    Are there any other methods..?

    Regards,
    Leanne

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Answer ✓

    Hi Leanne,

    Did you try enabling the serverSide option that is mentioned in the FAQ Colin linked to? It should help a bit with so many join conditions. To enable, change:

    ajax: "data.php",
    

    to be:

    serverSide: true,
    ajax: {
      url: "data.php",
      type: 'post
    }
    

    (since it needs to be a POST request for how the PHP is setup there).

    Failing that, add ->debug(true) to your initial Editor (PHP) chain which will result in the SQL that is being generated being returned to the client, so you can see what the SELECT statement is.

    The next step would be to use EXPLAIN ... on that SELECT statement, so your SQL server can tell you why the query is running slowly.

    My guess would be that one or more of your left join conditions are being done on non-indexed columns.

    Allan

  • binexlinebinexline Posts: 27Questions: 10Answers: 0

    Hi Allan,

    WOW adding ->debug(true) and testing with the query generated from here pointed me to the right direction!! This query takes 13sec to process...!
    Strange, because I have this another query that does the exact same thing but the query is structured differently and takes only about 4sec to process.

    THANK YOU

  • binexlinebinexline Posts: 27Questions: 10Answers: 0

    OK, Allan, you're right,

    Below section of the query was the problem.

    (SELECT Count(*)
    FROM   TB_EDI_SND_HIS
    WHERE  EDI_MSG_NO LIKE 'AGT%' AND EDI_MSG_TXT LIKE '%' + BL.INTG_BL_SEQ + '%')
    

    This section wasn't included in my another query which was why it only took 4sec.

    Thank you again for your help!

  • binexlinebinexline Posts: 27Questions: 10Answers: 0

    @allan ,

    The table still loads very slowly even after I fixed my query and the query itself runs fast..
    The 'Waiting (TTFB)' still takes 13sec when loading the datatable.

    Do you know any other methods to reduce this time...?

    Regards,
    Leanne

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    Hi Leanne,

    With the debug mode still enabled, what does the query look like now? Can you show me the JSON response when you load the table?

    Allan

  • binexlinebinexline Posts: 27Questions: 10Answers: 0

    Hi Allan,

    Yes, it looks like below:

    bindings: [
      {
        "name": ":where_0",
        "value": "O",
        "type": null
      },
      {
        "name": ":where_1",
        "value": "N",
        "type": null
      },
      {
        "name": ":where_2",
        "value": "N",
        "type": null
      },
      {
        "name": ":where_3",
        "value": "S",
        "type": null
      },
      {
        "name": ":where_4",
        "value": "M",
        "type": null
      },
      {
        "name": ":where_5",
        "value": 8,
        "type": null
      }
    ]
    
    query: "SELECT  [BL].[INTG_BL_SEQ] as 'BL.INTG_BL_SEQ', [BL].[RGST_OFC_CD] as 'BL.RGST_OFC_CD', ROW_NUMBER() OVER (ORDER BY BL.POST_DT DESC, BL.MODI_TMS DESC) as 'ROW_NUMBER() OVER (ORDER BY BL.POST_DT DESC, BL.MODI_TMS DESC)', [BL].[BL_NO] as 'BL.BL_NO', [BL].[REF_NO] as 'BL.REF_NO', [BL].[REF_OFC_CD] as 'BL.REF_OFC_CD', [OFC].[OFC_ADDR] as 'OFC.OFC_ADDR', [OFC].[OFC_LOCL_NM] as 'OFC.OFC_LOCL_NM', [OFC].[OFC_PHN] as 'OFC.OFC_PHN', [OFC].[OFC_FAX] as 'OFC.OFC_FAX', [OFC].[DOCK_RCPT_RMK] as 'OFC.DOCK_RCPT_RMK', [BL].[LNR_BKG_NO] as 'BL.LNR_BKG_NO', [BL].[ETD_DT_TM] as 'BL.ETD_DT_TM', [BL].[ETA_DT_TM] as 'BL.ETA_DT_TM', [BL].[POR_NM] as 'BL.POR_NM', [BL].[POL_NM] as 'BL.POL_NM', [LOC_POL].[UN_LOC_CD] as 'LOC_POL.UN_LOC_CD', [BL].[POD_NM] as 'BL.POD_NM', [LOC_POD].[UN_LOC_CD] as 'LOC_POD.UN_LOC_CD', [BL].[DEL_NM] as 'BL.DEL_NM', [BL].[OBRD_DT_TM] as 'BL.OBRD_DT_TM', (SELECT MAX(X.CNTR_NO) FROM TB_CNTR_LIST X WHERE X.INTG_BL_SEQ = BL.INTG_BL_SEQ AND X.DELT_FLG = 'N') as '(SELECT MAX(X.CNTR_NO) FROM TB_CNTR_LIST X WHERE X.INTG_BL_SEQ = BL.INTG_BL_SEQ AND X.DELT_FLG = "N")', (SELECT COUNT(X.CNTR_NO) - 1 FROM TB_CNTR_LIST X WHERE X.INTG_BL_SEQ = BL.INTG_BL_SEQ AND X.DELT_FLG = 'N') as '(SELECT COUNT(X.CNTR_NO) - 1 FROM TB_CNTR_LIST X WHERE X.INTG_BL_SEQ = BL.INTG_BL_SEQ AND X.DELT_FLG = "N")', [BL].[CNTR_INFO] as 'BL.CNTR_INFO', [BL].[PCK_QTY] as 'BL.PCK_QTY', [BL].[MK_TXT] as 'BL.MK_TXT', [BL].[SAD_TXT] as 'BL.SAD_TXT', [BL].[DESC_TXT] as 'BL.DESC_TXT', [BL].[CLEAN_ON_BOARD] as 'BL.CLEAN_ON_BOARD', [BL].[LNR_RMK] as 'BL.LNR_RMK', [BL].[MK_GRS_WGT] as 'BL.MK_GRS_WGT', [BL].[MK_GRS_WGT1] as 'BL.MK_GRS_WGT1', [BL].[MK_MEAS] as 'BL.MK_MEAS', [BL].[MK_MEAS1] as 'BL.MK_MEAS1', [BL].[FRT_TERM_CD] as 'BL.FRT_TERM_CD', [BL].[OBL_TP_CD] as 'BL.OBL_TP_CD', [BL].[FM_SVC_TERM_CD] as 'BL.FM_SVC_TERM_CD', [BL].[TO_SVC_TERM_CD] as 'BL.TO_SVC_TERM_CD', [BL].[ITN_NO] as 'BL.ITN_NO', [AGENT].[TRDP_NM] as 'AGENT.TRDP_NM', [AGENT].[TRDP_ADDR] as 'AGENT.TRDP_ADDR', [PRNR].[TRDP_NM] as 'PRNR.TRDP_NM', [PRNR].[TRDP_ADDR] as 'PRNR.TRDP_ADDR', [PRNR2].[TRDP_NM] as 'PRNR2.TRDP_NM', [SHPR].[TRDP_NM] as 'SHPR.TRDP_NM', [SHPR].[TRDP_ADDR] as 'SHPR.TRDP_ADDR', [SHPR_CNT].[CNT_ENG_NM] as 'SHPR_CNT.CNT_ENG_NM', [CNEE].[TRDP_NM] as 'CNEE.TRDP_NM', [CNEE].[TRDP_ADDR] as 'CNEE.TRDP_ADDR', [NOTIFY].[TRDP_NM] as 'NOTIFY.TRDP_NM', [NOTIFY].[TRDP_ADDR] as 'NOTIFY.TRDP_ADDR', [LNR].[TRDP_NM] as 'LNR.TRDP_NM', [CARR].[TRDP_NM] as 'CARR.TRDP_NM', [BL].[SHP_MOD_CD] as 'BL.SHP_MOD_CD', (SELECT MAX(X.ENG_USR_NM) FROM TB_USR X WHERE X.USR_TP = 'I' AND X.USRID = BND.ISSUED_BY) as '(SELECT MAX(X.ENG_USR_NM) FROM TB_USR X WHERE X.USR_TP = "I" AND X.USRID = BND.ISSUED_BY)', [BL].[POST_DT] as 'BL.POST_DT', [BL].[TRNK_VSL_NM] as 'BL.TRNK_VSL_NM', [BL].[TRNK_VOY] as 'BL.TRNK_VOY', (SELECT COUNT(*) FROM TB_INTG_BL_RLT RLT WHERE RLT.RLT_INTG_BL_SEQ = BL.INTG_BL_SEQ AND RLT.DELT_FLG = 'N') as '(SELECT COUNT(*) FROM TB_INTG_BL_RLT RLT WHERE RLT.RLT_INTG_BL_SEQ = BL.INTG_BL_SEQ AND RLT.DELT_FLG = "N")', [BL].[RLSD_FLG] as 'BL.RLSD_FLG', [BL].[RLSD_DT_TM] as 'BL.RLSD_DT_TM', ISNULL(BLCK.BL_STS_CD1, BL.BL_STS_CD) as 'ISNULL(BLCK.BL_STS_CD1, BL.BL_STS_CD)', ISNULL(BND.AR_CHK,'X') as 'ISNULL(BND.AR_CHK,"X")', ISNULL(BND.AP_CHK,'X') as 'ISNULL(BND.AP_CHK,"X")', ISNULL(BND.DC_CHK,'X') as 'ISNULL(BND.DC_CHK,"X")', ISNULL(BND.FRT_CHK,'X') as 'ISNULL(BND.FRT_CHK,"X")', [BL].[DOC_CUT_OFF_DT] as 'BL.DOC_CUT_OFF_DT', ISNULL(BND.VGM_CUT_OFF_DT,'') as 'ISNULL(BND.VGM_CUT_OFF_DT,"")', [BND].[SLS_USR_NM] as 'BND.SLS_USR_NM', [BL].[MODI_USR_NM] as 'BL.MODI_USR_NM', [BL].[CUST_REF_NO] as 'BL.CUST_REF_NO', [BND].[VERIFY_FLAG] as 'BND.VERIFY_FLAG', [BND].[PAY_FLAG] as 'BND.PAY_FLAG', [BL].[MODI_TMS] as 'BL.MODI_TMS', [BL].[RGST_TMS] as 'BL.RGST_TMS', ISNULL(BND.PKUP_DT, '') as 'ISNULL(BND.PKUP_DT, "")', [BL].[PRNR_REF_NO] as 'BL.PRNR_REF_NO' FROM  TB_INTG_BL as BL LEFT JOIN TB_ADD_INFO_BND as BND ON [BL].[INTG_BL_SEQ] = [BND].[INTG_BL_SEQ]  LEFT JOIN TB_BL_PRNR as PRNR ON [BL].[INTG_BL_SEQ] = PRNR.INTG_BL_SEQ AND PRNR.BL_TRDP_TP_CD = 'P01' AND PRNR.DELT_FLG = 'N'  LEFT JOIN TB_BL_PRNR as PRNR2 ON [BL].[INTG_BL_SEQ] = PRNR2.INTG_BL_SEQ AND PRNR2.BL_TRDP_TP_CD = 'P03' AND PRNR2.DELT_FLG = 'N'  LEFT JOIN TB_BL_PRNR as AGENT ON [BL].[INTG_BL_SEQ] = AGENT.INTG_BL_SEQ AND AGENT.BL_TRDP_TP_CD = 'A01' AND AGENT.DELT_FLG = 'N'  LEFT JOIN TB_BL_PRNR as SHPR ON [BL].[INTG_BL_SEQ] = SHPR.INTG_BL_SEQ AND SHPR.BL_TRDP_TP_CD = 'S01' AND SHPR.DELT_FLG = 'N'  LEFT JOIN TB_TRDP as SHPR_TRDP ON [SHPR_TRDP].[TRDP_CD] = [SHPR].[TRDP_CD]  LEFT JOIN TB_CNT as SHPR_CNT ON [SHPR_CNT].[CNT_CD] = [SHPR_TRDP].[CNT_CD]  LEFT JOIN TB_BL_PRNR as CNEE ON [BL].[INTG_BL_SEQ] = CNEE.INTG_BL_SEQ AND CNEE.BL_TRDP_TP_CD = 'C01' AND CNEE.DELT_FLG = 'N'  LEFT JOIN TB_BL_PRNR as NOTIFY ON [BL].[INTG_BL_SEQ] = NOTIFY.INTG_BL_SEQ AND NOTIFY.BL_TRDP_TP_CD = 'N01' AND NOTIFY.DELT_FLG = 'N'  LEFT JOIN TB_BL_PRNR as LNR ON [BL].[INTG_BL_SEQ] = LNR.INTG_BL_SEQ AND LNR.BL_TRDP_TP_CD = 'L01' AND LNR.DELT_FLG = 'N'  LEFT JOIN TB_BL_PRNR as CARR ON [BL].[INTG_BL_SEQ] = CARR.INTG_BL_SEQ AND CARR.BL_TRDP_TP_CD = 'B01' AND CARR.DELT_FLG = 'N'  LEFT JOIN (SELECT INTG_BL_SEQ AS INTG_BL_SEQ1, BL_STS_CD AS BL_STS_CD1 FROM TB_INTG_BL_BLCK) as BLCK ON [BL].[INTG_BL_SEQ] = [BLCK].[INTG_BL_SEQ1]  LEFT JOIN TB_OFC as OFC ON [BL].[REF_OFC_CD] = OFC.OFC_CD AND OFC.DELT_FLG = 'N'  LEFT JOIN TB_LOC as LOC_POL ON [LOC_POL].[LOC_CD] = [BL].[POL_CD]  LEFT JOIN TB_LOC as LOC_POD ON [LOC_POD].[LOC_CD] = [BL].[POD_CD] WHERE [BND].[BND_CLSS_CD] = :where_0 AND  [BND].[DELT_FLG] = :where_1 AND  [BL].[DELT_FLG] = :where_2 AND  [BL].[AIR_SEA_CLSS_CD] = :where_3 AND  [BL].[BIZ_CLSS_CD] = :where_4 AND  LEN(BL.ETD_DT_TM) = :where_5 AND  [BL].[ETD_DT_TM] BETWEEN 20210423 AND 20210622 "
    
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Answer ✓

    It doesn't look like server-side processing is enabled as I suggested before. Did you try enabling it? Does it make a difference?

    Allan

  • binexlinebinexline Posts: 27Questions: 10Answers: 0

    @allan ,

    Yes I tried server-side processing before but it didn't make any difference. :/

    :open_mouth: :open_mouth: :open_mouth: WOW ok, when I tried server-side processing in the beginning before I fixed my query, it didn't make any difference, but as I was writing this comment, I tried again, and this now fixed the speed issue!!!!

    THANK YOU

This discussion has been closed.