Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7707689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:25:25+00:00 2026-06-01T00:25:25+00:00

I have a table created like this: CREATE TABLE rh857_omf.picture(MeasNr TINYINT UNSIGNED, ExperimentNr TINYINT

  • 0

I have a table created like this:

CREATE TABLE rh857_omf.picture(MeasNr TINYINT UNSIGNED, ExperimentNr TINYINT UNSIGNED,
Time INT, SequenceNr SMALLINT UNSIGNED, Picture MEDIUMBLOB, PRIMARY KEY(MeasNr, 
ExperimentNr, Time, SequenceNr));

The first four rows MeasNR, ExperimentNr, Time and SequenceNr are the identifiers and are set as primary key. The fifth row, Picture, is the payload. Its an 800×800 Pixel 8Bit grey value picture (Size = 625 kBytes).

If I want to load a picture, I use the following command:

SELECT Picture FROM rhunkn1_omf.picture WHERE MeasNr = 2 AND 
ExperimentNr = 3 AND SequenceNr = 150;

In the MySQL workbench, I see the duration and the fetch time if I run this command! For smaller tables (800 MBytes, 2376 entries, picture 640×480), its very fast (<100ms). If I take a bigger table (5800 MBytesm, 9024 entries), it gets very slow (>9s).

For instance, I run the following command (on the big table):

SELECT Picture FROM rhunkn1_omf.picture WHERE MeasNr = 2 AND 
ExperimentNr = 3 AND SequenceNr = 1025 LIMIT 0, 1000;

the first time it takes 5.2 / 3.9 seconds (duration / fetch). The same command for the second time takes 0.2 / 0.2 seconds. If I change the SequenceNr

SELECT Picture FROM rhunkn1_omf.picture WHERE MeasNr = 2 AND 
ExperimentNr = 3 AND SequenceNr = 977 LIMIT 0, 1000;

its also very fast 0.1 / 0.3 seconds

But if I change the the ExperimentNr, for instance

SELECT Picture FROM rhunkn1_omf.picture WHERE MeasNr = 2 
AND ExperimentNr = 4 AND SequenceNr = 1025 LIMIT 0, 1000;

it takes long time 4.4 / 5.9 seconds.

Does anybody know why the database behaves like that and how I could improve the speed? Does it help if I create several smaller picture tables and split the load for each table? By the way, I use MySQL 5.1.62 and the MyISAM tables, but I also tested InnoDB which was even slower.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:25:26+00:00Added an answer on June 1, 2026 at 12:25 am

    It would help if you could post the EXPLAIN for the query – mostly, the answers are in there (somewhere).

    However, at a guess, I’d explain this behaviour by the fact your primary key includes TIME, and your queries don’t; therefore, they may make only partial use of the index. I’d guess the query plan uses the index to filter out records in the MEASNR and ExperimentNr range, and then scans for matching sequenceNrs. If there are many records which match the first two criteria, that could be quite slow.

    The reason you see a speed up second time round is that the queries get cached; this is not hugely predictable, depending on load, cache size etc.

    Try creating an index which matches your “where” clause, and see EXPLAIN tells you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In MSSQL I have a table created like this: CREATE TABLE [mytable] (fkid int
I have a table that's created like this: CREATE TABLE bin_test (id INTEGER PRIMARY
I have created an index on my table like this: CREATE INDEX index_typ_poplatky ON
I have something like this: create table account ( id int identity(1,1) primary key,
I have a testdata like this: DROP TABLE SELECT_PASS; CREATE TABLE SELECT_PASS(ID INT(20),TESTCASE VARCHAR(20),RESULT
I have an sqlite database on android created like this: sqlite> .schema CREATE TABLE
I have a table that looks like this CREATE TABLE `time_table` ( `id` INT(10)
I have created a table like this: CREATE TABLE #TEMP(RecordDate datetime, First VARCHAR(255), Last
If I have a table like this: CREATE TABLE sizes ( name ENUM('small', 'medium',
I have a table in PostgreSQL where the schema looks like this: CREATE TABLE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.