Notices by Toksyuryel (toksyuryel) tagged sql

  1. Before I go to bed, I wanted to share this because it makes me happy. http://dpaste.com/749403/ @widget @bitshift !coderpony #

    Thursday, 17-May-12 16:31:19 UTC from web
  2. Pre-caching the path instead of generating it dynamically seems to only improve cached performance (though the improvement there is dramatic). In some cases the uncached performance was actually *worse* than generating the path in a WITH RECURSIVE block. http://pgsql.privatepaste.com/60741d539f @bitshift @widget !coderpony #

    Monday, 14-May-12 09:32:33 UTC from web
  3. So, first test: building the paths in a WITH RECURSIVE block under normal settings. Test shows that this is, indeed, unacceptably slow but cached performance is phenomenal until the thread gets monstrously huge; as real world threads will never get as big as even the smallest thread in this sample, and certainly won't be so spread out, I consider the cached performance to be acceptable but I'd like something better for uncached performance. Now let's test it with the pre-computed paths. http://pgsql.privatepaste.com/205d6138f2 @bitshift @widget !coderpony #

    Monday, 14-May-12 09:10:37 UTC from web
  4. Hm, that was done faster than I thought. I estimated the total size would get to be over 5GB but it only got to 4.1GB before it finished. Here's an hour-by-hour breakdown of how long it took to populate the database with over ten million rows: http://dpaste.com/747878/ !coderpony #

    Monday, 14-May-12 08:23:58 UTC from web in context
  5. At one million rows, the performance increase of sorting on a pre-computed path is negligible compared to generating the path in a WITH RECURSIVE block. I'll generate another ten million rows overnight and see how that performs tomorrow. #

    Sunday, 13-May-12 07:06:30 UTC from web
  6. I can't understand what this error is about. All of my parenthesis seem to line up properly (and it successfully creates the first two tables before the one with the error) and I don't see any misplaced or missing semicolons. Any help? http://dpaste.com/747347/ @bitshift @widget !coderpony #

    Sunday, 13-May-12 01:13:01 UTC from web in context
  7. Also I do believe this is the first valid use of an array I've found. #

    Saturday, 12-May-12 22:44:26 UTC from web
  8. Alright I figured out what I need to do. If we store the path to each post directly in the database, there is no need for a recursive query. Sorting is fast and fetching posts by thread is also fast, so as long as these are the only things we're doing the result will be fast. Unfortunately testing this against ten million posts will have to wait until tomorrow as implementing this requires updating the schema. I believe that there is nothing further I can do with this database so it's time to drop it and get that new schema in there. #

    Saturday, 12-May-12 22:43:22 UTC from web in context
  9. Here's a comparison of uncached performance vs cached performance http://dpaste.com/747276/ @bitshift @widget !coderpony #

    Saturday, 12-May-12 20:37:27 UTC from web in context
  10. Performance is pretty terrible with ten million rows. I'll have to work out a way to deal with it. #

    Saturday, 12-May-12 18:55:22 UTC from web
  11. I wonder how long ago this would have been done if I could use COPY. I started populating four and a half hours ago and it's not even two-thirds done yet. #

    Saturday, 12-May-12 00:05:40 UTC from web
  12. Just to see how well this really scales, let's try it with ten million pots. Predictions? #

    Friday, 11-May-12 19:35:35 UTC from web
  13. I'm pretty happy about this. http://dpaste.com/746779/ @widget @bitshift !coderpony #

    Friday, 11-May-12 19:14:58 UTC from web
  14. Good news: I've identified what sort of query I need in order to output conversations sorted as threads. Bad news: it's WITH RECURSIVE. #

    Friday, 11-May-12 13:30:26 UTC from web
  15. Also the fact that CHECK constraints can contain functions in general really. #

    Friday, 11-May-12 12:33:50 UTC from web
  16. I have discovered that CHECK constraints can contain subqueries if you encapsulate them inside of functions. This opens up so many possibilities. #

    Friday, 11-May-12 12:31:49 UTC from web
  17. Learning quite a few things about what I've been doing wrong. It's great to be able to finally test this stuff. #

    Friday, 11-May-12 05:22:41 UTC from web
  18. I wonder if it's preferred to chain table joins or use subqueries... it seems like both ultimately accomplish the same thing, just in different ways. Which performs better? Something I'll have to stop being lazy about rebooting to check. (technically I could check now but I don't really want to while still on the LiveCD) #

    Thursday, 10-May-12 08:06:19 UTC from web
  19. So many joins @.@ #

    Thursday, 10-May-12 07:59:38 UTC from web
  20. A question arises: if a column references its own table as a foreign key with ON DELETE RESTRICT and just so happens to refer to its own row, is that row simply completely impossible to delete or will it be deleted normally? !coderpony #

    Thursday, 10-May-12 00:42:11 UTC from web
  21. Today's lesson: arrays are evil. http://dpaste.com/745811/ @bitshift !coderpony #

    Thursday, 10-May-12 00:31:17 UTC from web
  22. Hm, I think my problem is not enough tables. Let's refactor this whole thing and make like a bajilion tables. #

    Wednesday, 09-May-12 23:16:47 UTC from web
  23. @bitshift I dunno, I designed half of it while half asleep anyway. Here it is anyway for your perusal http://dpaste.com/745314/ (to anyone just joining us, I'm learning all of this as I go and currently lack the means to test whether I've gotten any of this right, so if the syntax and such is completely wrong it's because I have no idea what I'm doing) !coderpony #

    Wednesday, 09-May-12 05:34:44 UTC from web in context
  24. @bitshift So how'd I do? :) http://dpaste.com/745233/ !coderpony #

    Wednesday, 09-May-12 00:47:20 UTC from web in context
  25. @toksyuryel @bitshift I realized I forgot some conditionals in one of the stubbed functions, here's a fixed version of that http://dpaste.com/745201/ !coderpony #

    Tuesday, 08-May-12 23:10:58 UTC from web in context
  26. @bitshift I have stubbed out several functions and created the triggers to demonstrate how I plan to constrain the arrays http://dpaste.com/745194/ !coderpony #

    Tuesday, 08-May-12 23:05:16 UTC from web in context
  27. @bitshift Let's see how horribly I botched this one up http://dpaste.com/745169/ !coderpony #

    Tuesday, 08-May-12 22:09:18 UTC from web in context
  28. @bitshift http://dpaste.com/745125/ here's what it looks like now !coderpony #

    Tuesday, 08-May-12 20:50:47 UTC from web in context
  29. @bitshift As long as I'm using dpaste I might as well just post the entire file. Let me know how much I screwed everything up! http://dpaste.com/745106/ !coderpony #

    Tuesday, 08-May-12 20:34:16 UTC from web in context
  30. Did I do this right? ` replyto bigint CHECK (replyto IS NOT postid AND replyto IS CASE WHEN conversation IS NOT postid THEN NOT NULL),` !coderpony #

    Tuesday, 08-May-12 20:19:16 UTC from web in context