Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. More than 20000 idata_* tables

More than 20000 idata_* tables

Scheduled Pinned Locked Moved Support
8 Posts 2 Posters 43.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    M
    Mortymer
    wrote on last edited by
    #1

    Hello everybody,
    Today I checked the mysql folder in "netxms". I found more than 20000 idata tables. Most of tables are empty.
    Can I drop the unused tables?
    Someone has any idea?

    Thank you for any help!
    Regards,
    Mortymer

    1 Reply Last reply
    0
    • A
      A
      Alex Kirhenshtein
      wrote on last edited by
      #2

      Hello.

      Number of idata tables should be roughly the same as number of nodes in the system.

      This query should return list of tables without corresponding record in nodes or clusters:

      SELECT s.id,s.name FROM (SELECT substr(t.table_name,7) AS id, t.table_name AS name FROM information_schema.tables t WHERE t.table_schema='mtest' AND t.table_name LIKE 'idata_%') AS s WHERE s.id NOT IN (SELECT id FROM nodes UNION SELECT id FROM clusters);
      
      1 Reply Last reply
      0
      • M
        M
        Mortymer
        wrote on last edited by
        #3

        Thank you Alex,

        With this script I'm gonna do the cleaning.

        Regards,
        Mortymer

        1 Reply Last reply
        0
        • M
          M
          Mortymer
          wrote on last edited by
          #4

          Hello Alex,

          Can I use this script to listing the unused "tdata_" tables?

          Regards,
          Mortymer

          1 Reply Last reply
          0
          • A
            A
            Alex Kirhenshtein
            wrote on last edited by
            #5

            There was a mistake in the script - there are few more object types which can have idata_* tables.
            Please use this script instead:

            SELECT s.name FROM (
                SELECT
                    substr(t.table_name,7) AS id,
                    t.table_name AS name
                FROM information_schema.tables t
                WHERE
                    t.table_schema='mtest'
                    AND t.table_name LIKE 'idata_%') AS s
            WHERE s.id NOT IN (
                    SELECT id FROM nodes
                    UNION SELECT id FROM clusters
                    UNION SELECT id FROM access_points
                    UNION SELECT id FROM sensors
                    UNION SELECT id FROM mobile_devices
                );
            
            1 Reply Last reply
            0
            • M
              M
              Mortymer
              wrote on last edited by
              #6

              Thank you Alex,

              And can I use this script at tdata_ tables?

              Regards,
              Mortymer

              1 Reply Last reply
              0
              • A
                A
                Alex Kirhenshtein
                wrote on last edited by
                #7

                Yes

                1 Reply Last reply
                0
                • M
                  M
                  Mortymer
                  wrote on last edited by
                  #8

                  Hello,

                  When I used the last script I had no result.
                  I checked the access_points table and I found many same rows.
                  Screenshot attached.
                  What do you think about this.
                  The Node 842 is a Mikrotik router.

                  I used this script to check how many duplicated records I have.

                  select count(*), ap.node_id, ap.mac_address, ap.vendor, ap.model, ap.serial_number, ap.ap_state, ap.ap_index
                    from access_points ap
                   group by ap.node_id, ap.mac_address, ap.vendor, ap.model, ap.serial_number, ap.ap_state, ap.ap_index
                  

                  I attached the results.

                  Any idea or suggestion?

                  Thank you for any help!

                  Regards,
                  Mortymer


                  heidisql.PNG

                  heidisql-2.PNG

                  1 Reply Last reply
                  0

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  Powered by NodeBB Contributors
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups