WordPress.org

Ready to get started?Download WordPress

Forums

meta query with lots of custom meta (1 post)

  1. nicola.bonotto
    Member
    Posted 11 months ago #

    Hi,
    I have a WP_Query with this meta_query parameter:
    [meta_query] => Array
    (
    [0] => Array
    (
    [key] => wpcf-categoria_annuncio
    [value] => 1
    [compare] => =
    )

    [1] => Array
    (
    [key] => wpcf-tipologia
    [value] => 1
    [compare] => =
    )

    [2] => Array
    (
    [key] => wpcf-nlocali
    [value] => 3
    [compare] => =
    )

    [3] => Array
    (
    [key] => wpcf-bagni
    [value] => 1
    [compare] => =
    )

    [4] => Array
    (
    [key] => wpcf-importo
    [value] => Array
    (
    [0] => 33579
    [1] => 511210
    )

    [type] => numeric
    [compare] => BETWEEN
    )

    [5] => Array
    (
    [key] => wpcf-superficie
    [value] => Array
    (
    [0] => 1080
    [1] => 5700
    )

    [type] => numeric
    [compare] => BETWEEN
    )

    [6] => Array
    (
    [key] => wpcf-nome_regione
    [value] => Veneto
    [compare] => =
    )

    [7] => Array
    (
    [key] => wpcf-sigla_provincia
    [value] => TV
    [compare] => =
    )

    [8] => Array
    (
    [key] => wpcf-comune_istat
    [value] => 026086
    [compare] => =
    )

    [9] => Array
    (
    [key] => wpcf-localita
    [value] => Monigo
    [compare] => =
    )

    [10] => Array
    (
    [key] => wpcf-codice-classe-energetica
    [value] => 5
    [compare] => =
    )

    [11] => Array
    (
    [key] => wpcf-riscaldamento_id
    [value] => 2
    [compare] => =
    )

    [12] => Array
    (
    [key] => wpcf-condizioni_id
    [value] => 2
    [compare] => =
    )

    [13] => Array
    (
    [key] => wpcf-codice_autorimessa
    [value] => 1
    [compare] => =
    )

    )

    I know that Mysql crashes doing this query because of too many "join" on wp_postmeta table. Now my quetion is: is there a way to query on multiple custom post meta without blocking my DB?

    Thanks

Reply

You must log in to post.

About this Topic

  • RSS feed for this topic
  • Started 11 months ago by nicola.bonotto
  • This topic is not resolved
  • WordPress version: 3.5.1