Echo巨大的SQL查询结果

时间:2012-07-12 12:13:20

标签: php sql echo large-data

我有一个连接很多列的查询。我认为它目前足够快(结果是5000行)但是如果条目数量增加呢?

如果我想通过PHP echo语句显示结果页面重载...

如何才能显示如此大的结果?

这是我的SQL查询:

SELECT DISTINCT 
    dominios.dominio as dominio, 
    dominios.id_dominio as id_dominio, 
    dominios.data_insercao as data_insercao, 
    datas.data_insercao as data_insercao, 
    datas.data_expiracao as data_expiracao, 
    dnss.record1 as dns1, 
    entidades_gestoras.nome as ent_nome, 
    entidades_gestoras.email as ent_email, 
    estados.estado as estado, ips.ip as ip, 
    responsaveis_tecnicos.nome as resp_nome, 
    responsaveis_tecnicos.email as resp_email, 
    titulares.nome as tit_nome, 
    titulares.morada as tit_morada, 
    titulares.email as tit_email, 
    titulares.localidade as tit_localidade, 
    titulares.cod_postal as tit_postal 
from 
    dominios 
        left join datas 
            on dominios.id_dominio=datas.id_dominio 
        left join dnss 
            on dominios.id_dominio=dnss.id_dominio 
        left join entidades_gestoras 
            on dominios.id_dominio=entidades_gestoras.id_dominio 
        left join estados 
            on dominios.id_dominio=estados.id_dominio 
        left join ips 
            on dominios.id_dominio=ips.id_dominio 
        left join quantidade_dnss 
            on dominios.id_dominio=quantidade_dnss.id_dominio 
        left join responsaveis_tecnicos 
            on dominios.id_dominio=responsaveis_tecnicos.id_dominio 
        left join titulares 
            on dominios.id_dominio=titulares.id_dominio

是的,我需要所有值来应用过滤器,并在桌面上进行即时搜索。

感谢您的帮助:)

2 个答案:

答案 0 :(得分:2)

如果您有巨大的结果,请尝试在您的网页上使用LIMIT和分页技术。

答案 1 :(得分:1)

我建议使用jQuery和插件Datatables,它允许您进行服务器端搜索,并且也很容易设置。

我在我的几个项目中都有它,并且有50k行甚至更多的表。如果您只加载100行并让用户通过它们进行搜索或搜索,则可以获得良好而顺畅的使用体验。

对于ajaxdatasourced表查看this Link