ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

High logical reads

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • High logical reads

    We have a table that has very high logical reads, billions in an hour. It is a table that holds start and end ip ranges and their country of origin. Our website looks up incoming ip addresses and then does whatever they do with the country. Been trying to figure out how to get the reads down. I have tried several different indexes and variations of the statement.

    Table ddl.
    Code:
    IP_FROM BIGINT NOT NULL , 
        IP_TO BIGINT NOT NULL , 
        COUNTRY_CODE2 FOR COLUMN COUNT00001 VARCHAR(2) CCSID 37 DEFAULT NULL , 
        COUNTRY_NAME FOR COLUMN COUNT00003 VARCHAR(50) CCSID 37 DEFAULT NULL
    Statement
    Code:
    [B]SELECT country_code2, country_name FROM iptoc2 WHERE IP_FROM<=21102592 AND IP_TO>=21102592 fetch first row only[/B]

  • #2
    Can you give some statistics? How many rows in the table? For the example query, how many rows are on each part of the WHERE clause and how many meet the full WHERE clause?
    Tom

    There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

    Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

    Comment


    • #3
      There are 167k records. The number of rows that satisfy each part of the where clause can vary depending on which ip is coming in. For example if the start and end ips were 1 - 10, 11- 20 etc... until 91 - 100 if the incoming ip is 95 only one row would ever satisfy the whole where clause 10 rows would satisfy the first part of the where clause and only one would satisfy the second part.

      If the incoming ip is 55 again only 1 row satisfys both but 5 rows satisfy the first part and 5 rows satisfy the second part.

      Is that what you were asking?

      Comment

      Working...
      X