Jump to content

Basic SQLite question


 Share

Recommended Posts

Really?

I sincerely doubt you have tabulated (or are going to tabulate) 20010 values, even if in the form of a binary outcome.

20010 = 102 400 000 000 000 000 000 000

Storing binary values, that would be a bare minimum of 102.4 / 8 1021 = 12.8 zettabytes

So SQLite might still be an efficient way to solve "someting" in your area of interest but the problem has to be clearly exposed.

EDIT: to answer your recent post on the list, yes reply to the group (sqlite-users@sqlite.org) but please keep track of the thread (depends on your mail client).

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

Definitely not 20010. ~10 criteria (I don't know the exact number yet), with anywhere from 8 to 150 possibilities per column. I estimated about 400k values, which I am resigned to entering manually (many are redundant).

>> SQLite might still be an efficient way to solve "someting" in your area of interest

'Efficient' with respect to what?

>> but the problem has to be clearly exposed.

Meaning what exactly? I'm under the impression the problem is clearly exposed. It is completely analogous to the height/weight problem, only scaled up. What else do you think I'm missing?

Link to comment
Share on other sites

Just that with your low estimate (8 possibilities per column) you end up with 810 = 1 073 741 824 entries, not 400k.

With an average estimate (8 + 150) / 2 = 79 possibilities per column you end up with 7910 entries (= 9 468 276 082 626 847 201), not 400k.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

The numbers were ceiling guestimates I inserted merely to illustrate the potential scale of my scenario. As it stands, I have 5 different criteria, with possibilities of 8, 9, 3, 12, and 170. giving a total of ~440k entries.

What about this question I posed earlier? This is the answer I've been driving towards since my original post:

>> SQLite might still be an efficient way to solve "someting" in your area of interest

'Efficient' with respect to what?

Link to comment
Share on other sites

OK things are getting sharper but get ready for a painful time loading data!

Efficient in query speed and disk and/or RAM (your choice). Don't get into premature optimization pitfall!

If you're ready with your project, making a single table with columns holding min and max for each criterion and group column is OK.

Then your queries can be as simple as:

select thegroup from mychart where $height between minheight and maxheight and $weight between minweight and maxweight and ...

Making that fast implies creating indices on criterion data.

The whole baby can certainly fit in memory.

To answer the parallel question, yes it will be faster than Excel, once tuned if necessary.

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

>> get ready for a painful time loading data!

Yes I know. There may be a way to automate some of it.

>> Don't get into premature optimization pitfall!

I'm way too novice to understand this right now.

>> Making that fast implies creating indices on criterion data.

I don't quite understand this either, but I *am* interested in making it fast. I gather I should look up indices for more information?

Link to comment
Share on other sites

No leave that for the last step!

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Correct. I advise you to download the free version of SQLite Expert and start playing with it by building toy examples in order to familiarize yourself with SQL. Also have a look at some of the links in my signature.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

I've already looked at all your links, but didn't quite follow the tutorials or book. There are plenty of others though online that I've been trying. I hadn't heard of SQLite Expert, but I'll download it and start playing with it. Thanks for your advice and patience!

Link to comment
Share on other sites

cag8f,

Can you show an example of what your data tables might look like (criteria)?

And explain, step by step, how you decide to categorize (groups) based on these tables?

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

cag8f,

Can you show an example of what your data tables might look like (criteria)?

And explain, step by step, how you decide to categorize (groups) based on these tables?

kylomas

Thats what I've been asking him for 3 days now, don't expect an answer any time soon that makes any kind of sense.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

@BrewmanNH - Yes, despite very specific answers from you and jchd...I thought that phrased this way might show the OP that tool selection is premature, define the problem first. (although I'm sure that SQLite is the answer given that spreadsheets are being considered)

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

>> tool selection is premature, define the problem first.

OK this statement is helpful. I'm learning here.

>> And explain, step by step, how you decide to categorize (groups) based on these tables?

There is no algorithm (or set of algorithms) that determines every group assignment. I know that Height2/Weight1/Age3 corresponds to Group A based on prior experience. Is that beginning to answer your question?

.

Below is a simplified version of what my data table might look like. For illustrative purposes, this table contains only 3 criteria, with 3 possible entries for each. The user would enter a height, weight, and age, and the program would access the data file, armed with the user entered data, and output the corresponding group. Again, assume this table will be larger in scale. This table has 27 different combinations, while my actual table will have ~400k different combinations (5 criteria, with 8, 9, 3, 12, and 170 possible entries respectively).

edit: fail on posting the data table. Re-posting the table. This is the best I can do with my limited formatting skills.

Ht Wt Age Group

H1 W1 A1 B

H1 W1 A2 B

H1 W1 A3 A

H1 W2 A1 B

H1 W2 A2 A

H1 W2 A3 A

H1 W3 A1 B

H1 W3 A2 B

H1 W3 A3 A

H2 W1 A1 B

H2 W1 A2 A

H2 W1 A3 A

H2 W2 A1 B

H2 W2 A2 B

H2 W2 A3 A

H2 W3 A1 B

H2 W3 A2 A

H2 W3 A3 B

H3 W1 A1 A

H3 W1 A2 A

H3 W1 A3 A

H3 W2 A1 B

H3 W2 A2 B

H3 W2 A3 A

H3 W3 A1 B

H3 W3 A2 B

H3 W3 A3 A

Edited by cag8f
Link to comment
Share on other sites

cag8f,

The assignment to groups has to follow some method whether it be an algorithm or some rule of thumb that you go by. It is certainly not arbitrary. Given that the number of groups is less than the number of criteria then group selection can be expressed in ranges. Would you say that is true?

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

>> The assignment to groups has to follow some method whether it be an algorithm or some rule of thumb that you go by

The assignment to groups does indeed follow rules that I know. These are empirical relationships. I *know* that a combination of h1/w3/a2 corresponds to Group B, I *know* that a combination of h3/w3/a1 corresponds to Group B, and so forth. I've literally observed these correspondences previously with with my own two eyes.

>> Given that the number of groups is less than the number of criteria then group selection can be expressed in ranges. Would you say that is true?

In my actual scenario, the number of groups will be greater than the number of criteria.

Link to comment
Share on other sites

Given that the number of groups is less than the number of criteria then group selection can be expressed in ranges.

That was my thinking too, there's no need for look up tables, or a database if we could figure out what puts person A into group A and person B into group B, which unfortunately, we have never gotten an answer to that question.

Now we're getting that there are more than 2 groups, and more criteria than we're being shown. I give up, and anyone else that wants to wade through this morass is more than welcome.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

>> Now we're getting that there are more than 2 groups, and more criteria than we're being shown.

I've said since my 2nd post that that there were more than 2 groups and 2 criteria, and that I was only presenting a simplified model of my data

>> if we could figure out what puts person A into group A and person B into group B,

These are empirical relationships. Right now there is no set of rules that determines what puts person A into group A, and person B into group B. Does that make sense to you?

Link to comment
Share on other sites

As Brewman is indicating, this can be done by simple inference rules.

SUch as

if A3 and NOT (H2 and W3) THEN Group = A.

This one line eliminates 10 lines in your table.

Once the rules are known then it becomes simple.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...